💼 This rule is enabled in the ✅
disallow invalid regular expression strings in
📖 Rule Details
This rule reports invalid regular expression patterns given to
Differences to ESLint's
There are two reasons we provide this rule:
Better error reporting.
Instead of reporting the whole invalid string, this rule will try to report the exact position of the syntax error.
Better support for complex constructor calls.
ESLint's rule only validates
RegExpconstructors called with simple string literals. This rule also supports operations (e.g. string concatenation) and variables to some degree.
📚 Further reading
This rule was introduced in eslint-plugin-regexp v1.0.0