Regex Escape Tool

Escape any text so a regular expression matches it literally.

● Your files are processed locally in your browser and are not uploaded to our servers.

How it works

The characters with a special meaning in regex — . * + ? ^ $ { } ( ) | [ ] \ / and - — are prefixed with a backslash. When the pattern goes inside a string literal (like new RegExp("…") or Java), backslashes must be doubled; choose the matching output.

FAQ

Why escape the slash?

In JavaScript regex literals /…/ the slash ends the pattern, so it must be escaped. It's harmless elsewhere.