3 chars · 1 line
8 chars · 1 line
3 chars · 1 line
8 chars · 1 line
Regex character class error
A [ starts a character class in JavaScript regex syntax. If the pattern ends before a matching ], RegExp construction fails with an unterminated character class error. This tool is free to use. No account or payment is required.
Last updated
Inside a class, characters such as - and ^ can change meaning. First close the class correctly; only then diagnose range ordering or escaping inside it.
Close the bracket around the intended alternatives.
[abc[abc]Common questions
It matches one character that is a, b, or c.
Usually yes when you want the bracket itself instead of starting a character class.
Yes, but placement and escaping matter. The class still needs an unambiguous closing bracket.
Debugging a specific Regex issue? Browse Regex troubleshooting.