🔎 Regex Escape Tool

Escape text so it can be used safely as a literal regex pattern. Runs in your browser.

Last updated: November 8, 2026 · By the BoltQuickTools team

Ready

Search for text that happens to contain regex symbols

If you drop a price, a file path or a user's search term into a regular expression, characters like ., $ and ( are treated as syntax and the pattern either fails or matches the wrong thing. Backslash-escaping them makes the engine read your text literally.

Using it

Paste into Text to Escape. Escaped Regex updates as you type, and the Escape button does the same thing on demand. Copy Regex takes the result, Load Sample fills in an example, and Clear empties both boxes.

Examples from the tool

Text to EscapeEscaped Regex
price: $19.99 (sale ends Friday)price: \$19\.99 \(sale ends Friday\)
C:\temp\*.logC:\\temp\\\*\.log
a/b-c [x]a/b-c \[x\]

Exactly these characters get a backslash: . * + ? ^ $ { } ( ) | [ ] \. Everything else, including line breaks, passes through unchanged. The status line counts the input, so the first example reads "Escaped 32 characters".

Where the output needs more work

Short answers

Does it work outside JavaScript?

The escaped characters are metacharacters in Python, PCRE, Java and .NET too, so the output generally works there. Python users can call re.escape in code instead.

Should I use this for a replacement string?

No. It only handles the pattern side. In a JavaScript replacement it is $ that matters, and a backslash has no special effect there.

How do I confirm the pattern matches?

Paste it into the regex tester with a sample of your data. For the rest of the syntax, see the regex cheatsheet.