AUTOESCAPE / REGEX
Regex Escape
Escape pattern symbols so JavaScript regexes match your text literally.
HTML escape / unescape
Turn reserved characters into HTML entities, or bring them back.
Ready when you are. Conversion happens as you type.
Regex: find exactly what you typed.
Regular expressions give punctuation special jobs. A dot can match almost any character. Brackets can define a character class. Parentheses create a group. That is useful when you want a pattern—and frustrating when you only want to find a filename, price or message literally.
Regex Escape adds a backslash before the JavaScript regex metacharacters in your input. It also escapes the forward slash so the output can be used with the slash delimiter of a JavaScript regex literal.
invoice.v2 (final) [paid] + $19.99
invoice\.v2 \(final\) \[paid\] \+ \$19\.99
Where this helps
- Building a search pattern from an exact filename.
- Matching a phrase that contains parentheses or brackets.
- Looking for a price containing a dollar sign and a decimal point.
- Preparing user-provided literal text before constructing a JavaScript regex pattern.
The result is not automatically anchored. If you want to match an entire string rather than find a literal substring, your application may need anchors such as ^ and $. Flags, input size and the rest of the pattern still need deliberate handling.
Pattern syntax is not string syntax
If you paste a regex pattern into a JavaScript quoted string, you have two layers to think about: regex escaping and JavaScript string escaping. A backslash that belongs to the pattern may itself need escaping in the source-code string. JSON String can help inspect a string representation, but it does not decide how your application should construct its regex.
There is no Unescape mode. Removing backslashes from an arbitrary pattern could turn literal text back into operators and quietly change what it matches.