Enter a string to escape for use inside a regular expression. Special regex characters (e.g. . * + ? [ ] ( ) ) are escaped so the pattern matches your text literally. Runs in your browser.
About Regex Escape
In regular expressions, characters like . * + ? [ ] ( ) have special meanings. If you want to search for them literally, you must escape them with a backslash. This tool does that for you: paste your string and get a version safe to use inside a regex.
How to use
- Enter the string you want to match literally in a regex.
- Click Escape for regex. Copy the result and use it in your pattern.
Frequently Asked Questions
Which characters are escaped?
Characters that have special meaning in regex are escaped: . * + ? ^ $ [ ] ( ) { } | \ and others. So the pattern matches your string literally.
Is my text sent to a server?
No. Escaping runs in your browser. Your text never leaves your device.
Can I use this in JavaScript replace?
Yes. Use the escaped string in new RegExp(escaped) or inside /.../ so that your search text is treated as literal, not as regex syntax.