Skip to content

Escape Regex Metacharacters

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

Input

25 chars1 lines

Result

Type or paste on the left — the result updates as you type.

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.

Format references

Tool page updated: