Regex Escape Tool for JavaScript Patterns
Escape literal text before placing it inside a regular expression. Useful for search boxes, generated filters, filenames, URLs, query strings, and code snippets.
Try a common regex escape
Escaped output
https://example\.com/search\?q=tools\+\(free\)&page=1
JavaScript snippet
const pattern = new RegExp("https://example\\.com/search\\?q=tools\\+\\(free\\)&page=1");
Literal strings
Use URLs, filenames, product names, and search phrases.
Generated patterns
Escape user input before composing it into a RegExp object.
Example
example.com/search?q=(free) becomes a literal-safe pattern with dots and parentheses escaped.
Assumption
You want the input text matched literally, not interpreted as regex syntax.
Limitation
The tool does not optimize regex performance or detect unsafe complete patterns.
Can I test the escaped regex?
Use the related Regex Tester after copying the escaped pattern.
Is this JavaScript focused?
Yes. The output is designed for JavaScript regular expressions.
Can it escape multi-line text?
Yes. It escapes regex syntax characters while preserving the text content.
How is escaping processed?
Escaping is handled in the browser for this tool based on the current public implementation.
Suggested workflow
Regex drafting path
Clean the source string, escape it, then test the full pattern.