About This Tool
When a string full of regex metacharacters, such as user input or a filename, has to go inside a pattern as plain text, this puts a backslash in front of each special character. Paste the string, choose the escape set, the anchors and the output form, and you get either the bare pattern, a slash literal, or a ready new RegExp call.
The standard set escapes fourteen characters: period, asterisk, plus, question mark, caret, dollar, both braces, both parentheses, the vertical bar, both square brackets and the backslash. Control characters such as a newline or tab are rewritten as escape sequences like backslash n, so the result survives being pasted into code as a single line. The slash and the hyphen are optional because whether they need escaping depends on where the pattern goes. Follows JavaScript regex syntax as of October 2026.
The pattern is then actually compiled with new RegExp, matched against the original, and checked against a probe string where the special characters have been swapped out, so an under-escaped pattern shows up as a false positive. Escaping a hyphen is a syntax error under the u and v flags, and that combination is flagged. This tool does not design or explain a regex for you, and it does not cover syntax differences in other implementations.
Frequently Asked Questions
A hyphen only acts as a range operator inside a character class, and a slash only ends the pattern inside a slash literal. Both matter only where the pattern lands, and escaping a hyphen outside a character class is a syntax error under the u flag.
A missing escape lets a character such as a period match anything. So the tool builds a probe where only the special characters are replaced with another letter and confirms the pattern does not match it. If it does match, something was left unescaped.
It does not design a regex for you or explain what one means. It also does not cover syntax differences in other implementations such as Python or PCRE.