\.

Regex Escape

Put backslashes in front of special characters so text can be used as an exact match inside a regex.

How it works

Special characters in a regex such as . * + ? ( ) [ ] { } | ^ $ and \ have a meaning of their own. To match them literally, put a backslash in front. Paste your text and the tool does it, so you can use it as an exact match inside a regex.

Worked example

"price (USD) [10.50]?" becomes "price \(USD\) \[10\.50\]\?".

Good to know

Common questions

Which characters are escaped?
. * + ? ^ $ { } ( ) | [ ] \ and optionally - and /.
Do I escape spaces?
No, spaces are literal in a regex unless the x flag is used.
Why escape at all?
So a user typed string cannot change the meaning of your pattern.

More in Developer.