Regex Escape / Unescape

Escape special regex characters in a string so it can be used as a literal pattern — or unescape it back.

Input String
Special characters escaped:
.*+?^ ${}[] ()|\
Escaped Output
About Regex Escaping

When you want to match a literal string that contains regex special characters (like ., *, + etc.), those characters must be escaped with a backslash so they are treated as literals rather than regex operators.

For example, to match the literal string 3.14, use the pattern 3\.14 — otherwise 3.14 would match 3, any character, and then 14.

The 14 characters that need escaping in JavaScript RegExp are: . * + ? ^ $ { } [ ] ( ) | \