Docomint

Escapar regex

Escapa todos los caracteres especiales de una expresión regular en una cadena, para que coincida como patrón literal.

🔒 Processed on your device

What is a Escapar regex?

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.

How to use the Escapar regex

  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

Example

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

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 — Escapar 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