Escape an expression

Developers can use this while debugging or preparing data for an exchange, especially when the result needs a quick visual check. Protect RegExp special characters.

Protect RegExp special characters. The result appears instantly in your browser, ready to copy, with no account, upload or storage involved.

How to use

  1. Paste or type into the input area the text that must be matched literally inside a regular expression.
  2. Run the escape action to protect the RegExp special characters found in that text.
  3. Copy the result and use it as a literal pattern in your code or configuration.
  4. If you need the original text back, use the unescape action to remove the added protections.
  5. Clear the areas after use so no sample or pattern is left behind.

Example

A developer wants to search for the string Price (EUR): 10.00? without having the parentheses, colon or question mark treated as regular expression symbols. They paste the text, run the escape action and get a safe pattern to place in their code.

Input

Price (EUR): 10.00?

Output

Price \(EUR\): 10\.00\?

Limits and formats

Where processing happens

The escaping is performed inside your browser on your device. The text you enter and the result are not sent outside. You can close the page after copying the pattern you need.

Frequently asked questions

When should I escape a string for a regular expression?

Whenever the string contains characters that have special meaning in a regular expression, such as parentheses, brackets, dots or question marks. Escaping makes the engine treat them as ordinary text instead of pattern symbols.

Can the tool also unescape text?

Yes, an opposite action removes the protections and returns the original text. Use it carefully, because a string that already contained backslashes may need a manual review after unescaping.

Can I escape a whole file?

You can import an accepted text, CSV, JSON, Markdown, XML or YAML file, but the action applies to the content you provide. Review the output, especially if the file has many lines or unusual characters.

Tools in the same category