Regex Escape Tool

Paste text to escape its regex special characters.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

Regular expressions treat certain characters as metacharacters with special meaning — a period matches any character, an asterisk means zero or more, parentheses group patterns, and so on. If you want to search for those characters literally (a period in a filename, a dollar sign in a price), you have to escape each one with a backslash so the regex engine treats it as plain text instead of an instruction.

This tool automatically prefixes every metacharacter in your input — including the period, asterisk, plus, question mark, parentheses, brackets, braces, pipe, caret, dollar sign, and backslash itself — with a backslash, producing a string safe to drop into any regex pattern. It's equivalent to what functions like JavaScript's RegExp.escape, Python's re.escape, or PHP's preg_quote do programmatically.

Developers reach for this when building a regex dynamically from user input — like a search box — where an unescaped special character would either throw a syntax error or silently match the wrong things.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators