Regex Escape Tool
Escape literal text into a JavaScript regular-expression pattern, including punctuation, whitespace and Unicode edge cases.
Start with your input
Edit the example or replace it with your own text.
How to use Regex Escape Tool
- Paste the example or your own input.
- Choose the options that match your task.
- Run the tool, review the result, then copy or download it.
When to use Regex Escape Tool
A literal string can accidentally become a very different search when passed directly to a regular-expression constructor. Escape pasted text before embedding it as a literal pattern. This tool uses JavaScript RegExp.escape when the browser provides it and a compatible fallback otherwise. The output is a pattern source that matches the input as literal text.
How to interpret the result
The first ASCII letter or digit may appear as a hexadecimal escape to avoid joining a preceding numeric escape when patterns are concatenated. Slashes, brackets, whitespace and other punctuation are escaped for use in Unicode-aware JavaScript patterns. The result is not a JSON string or a complete slash-delimited expression. If storing the pattern in source code or JSON, apply the string escaping required by that destination separately.
Example input
price (USD): $19.99 / item
What should I check before using the output?
The first ASCII letter or digit may appear as a hexadecimal escape to avoid joining a preceding numeric escape when patterns are concatenated.
Is input uploaded?
Processing takes place in your browser. This tool does not send your input or selected files to a conversion API.