Regex Escape Tool
Turn literal text into a pattern-safe string for new RegExp(). Metacharacters such as . * + ? ^ $ { } ( ) | [ ] \ are escaped so your search matches the text exactly as written.
Category: Developer Tools
About this tool
What Is Regex Escape Tool? The Regex Escape Tool converts literal user text into a pattern-safe string you can safely place inside a RegExp constructor. Metacharacters such as . * + ? ^ $ { } ( ) | [ ] \ are prefixed with a backslash so the engine treats your text exactly as written, not as pattern syntax. How It Works The tool walks the input once and prefixes each special character with a backslash (escaping the backslash itself as \\), then lets you test the result against a snippet and counts real matches in the page. Worked Example Input find.me (v2).* becomes the pattern find\.me \(v2\)\.\*. Pasted into new RegExp(escaped, 'g') it matches the literal text without interpreting the dot and parentheses as syntax. Common Use Cases escape user input before building search patterns paste safe literals into editors, linters, and scripts avoid accidental regex injection in dynamic patterns Important Notes escaping only affects pattern syntax — it does not alter the matched text for simple containment checks, prefer string includes/endsWith over regex the output is meant for RegExp constructors, not HTML or SQL contexts Related Tools Slug Generator — make clean URL slugs from text. URL Encoder/Decoder — encode and decode URL components. HTML Encoder/Decoder — encode and decode HTML entities. Markdown Editor — write and format Markdown documents. README Generator — draft README fil