Docomint

Escape Regex

Escape every regex special character in a string, so it can be matched as a literal pattern.

🔒 Processed on your device

When you need to match a literal string that happens to contain regex metacharacters — a price like "$5.00", a file path, a URL with dots and slashes — inside a larger pattern, every one of those characters needs escaping first, or the regex engine will misinterpret them. This does that automatically.

Example: "$5.00 (was $10.00)?" becomes "\$5\.00 \(was \$10\.00\)\?" — every metacharacter escaped, safe to insert into a pattern.

How it works

  1. Paste text that contains regex special characters
  2. Every special character is prefixed with a backslash, instantly on your device
  3. Copy the result — safe to drop into a larger regex pattern as a literal match

Frequently asked questions

Which characters get escaped?

The twelve regex metacharacters: . * + ? ^ $ { } ( ) | [ ] \ — every character JavaScript's regex engine treats as special gets a backslash added in front of it.

Is my data uploaded anywhere?

No — Escape Regex runs entirely in your browser using JavaScript/WebAssembly. Your data is never sent to a server.

Do I need to escape anything if I'm just using this text as a plain string, not inside a regex?

No — this only matters when the text will be interpreted as part of a regex pattern. A plain string comparison, or text used as-is, doesn't need any of these characters escaped.

Related tools