Skip to content

Escape Regex Metacharacters

Escape regular-expression metacharacters so text can be used as a literal pattern.

Convert in your browser · No sign-up

Produces a standalone JavaScript regex source fragment, not a full /pattern/ literal. Does not execute expressions or replace the full RegExp.escape specification.

Up to 100,000 UTF-16 units per input and 1,000,000 per result. See the supported formats and examples below.

Result

Add your input or load an example, then run the tool. Your result will appear here.

How to use

  1. Escape regular-expression metacharacters so text can be used as a literal pattern.
  2. Choose the mode or options, then run the tool.
  3. Review the result, then copy or download the TXT file.

Example

a+b?. → a\+b\?\.

Details and limitations

Text stays in your browser; it is not sent to a conversion server.

Format references

Tool page updated: