Regex Escape

Automatically escape regex metacharacters in a string for safe use in patterns.

Input data is processed in your browser
Data is never sent to a server

Tool

0 chars

or drag & drop a file

Mode
.\.dot (any char)
*\*asterisk (0+ quantifier)
+\+plus (1+ quantifier)
?\?question mark (0-1 / lazy)
^\^caret (anchor / negation)
$\$dollar (end anchor)
{\{opening brace
}\}closing brace
[\[opening bracket
]\]closing bracket
(\(opening paren (group)
)\)closing paren (group)
|\|pipe (alternation)
\\\backslash (escape char)
/\/forward slash (delimiter)

What is Regex Escape?

In regular expressions, characters like . * + ( carry special meaning as metacharacters.

When you use user input or external data directly in a regex pattern without escaping, those characters can cause unexpected matches or errors. Regex Escape automatically escapes all metacharacters so the string is treated as a literal value.

How to Use

  1. Paste the text you want to escape into the input field.
  2. Choose a mode depending on where you will use the result.
  3. The escaped string is generated instantly.
  4. Click Copy to copy it to your clipboard.

FAQ

Which characters get escaped?

In standard mode, all regex metacharacters are escaped: . * + ? ^ $ { } [ ] ( ) | \ /. Inside character class mode, only ] \ ^ - / are escaped. Literal mode uses the same set as standard.

What is the difference between the modes?

Standard is for use in a general pattern context. Inside [ ] class is for content placed inside a character class. Literal string match escapes everything so the result matches only the exact input string.

Why is the forward slash (/) escaped?

In JavaScript, a forward slash delimits regex literals (/pattern/). Escaping it makes the output safe for both regex literal and new RegExp() usage.

Is my data sent to a server?

No. All processing happens entirely in your browser.