Skip to content
JS
JavaScript error

SyntaxError

The JavaScript exception "character class escape cannot be used in class range in regular expression" occurs when a Unicode-aware regular expression pattern contains a character class where a boundary of a character range is another character class, such as a character class escape.

Reference entryJavaScriptFetched
SyntaxError: Invalid regular expression: /[\s-1]/u: Invalid character class (V8-based)
As listed by MDN Web Docs
SyntaxError: character class escape cannot be used in class range in regular expression (Firefox)
As listed by MDN Web Docs
SyntaxError: Invalid regular expression: invalid range in character class for Unicode pattern (Safari)
As listed by MDN Web Docs
Category
SyntaxError
Severity
error
Runtime
both
or press Cmd/Ctrl + Enter. The text is only sent to this site to match it.
Source: MDN Web Docs. Data fetched 2026-09-25T01:48:37.274Z.