Regex Escape

Escape regex special characters so your text matches literally — free, instant and private in your browser.




How to use

  1. Paste the text you want to use literally inside a regular expression.
  2. Choose a mode: escape for a regex pattern, or escape a replacement string so $ stays literal.
  3. Copy the escaped output and drop it straight into your pattern or replacement.

FAQ

Is my text sent to a server?

No. The escaping runs entirely in your browser with plain JavaScript, so your text never leaves the page. It works offline and stays private — safe for code, logs or anything sensitive.

Which characters get escaped?

In regex mode the special characters . * + ? ^ $ { } ( ) | [ ] and the backslash all get a backslash in front of them, so they match as plain text instead of acting as regex syntax. This is the same set escaped by common library functions.

When should I use replacement mode?

Use replacement mode when you are building the replacement string for a replace operation. There the dollar sign has special meaning ($1, $&, and so on), so this mode doubles each $ to $$ to keep it literal.