3 chars · 1 line
8 chars · 1 line
3 chars · 1 line
8 chars · 1 line
Regex escape error
A backslash begins an escape sequence. If it is the final character of the regex pattern, there is no following character to escape, so JavaScript cannot compile the RegExp. This tool is free to use. No account or payment is required.
Last updated
In the Regex pattern field you enter regex syntax directly, not a JavaScript string literal. Matching one literal backslash therefore requires a regex escape that itself is complete.
Remove the unfinished escape when no literal backslash is required.
abc\abcCommon questions
It announces an escape sequence but provides no character to escape.
No. A RegExp constructor inside code may also involve string-literal escaping, while this browser field accepts the regex pattern itself.
Yes. Use a complete regex escape for the backslash rather than leaving one unpaired at the end.
Debugging a specific Regex issue? Browse Regex troubleshooting.