25 lines
716 B
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
JavaScript regular expressions provide Unicode character classses and Unicode property escapes for matching characters based on their Unicode values and Unicode properties respectively. When using Unicode property escapes like `+\p{Alpha}+` without the `+u+` flag, the regular expression will not match alphabetic characters but rather the `+'\p{Alpha}+'` string literal, which is likely a mistake.
This rules raises an issue when Unicode character classses and Unicode property escapes are used without the `+u+` flag.
=== Noncompliant code example
2022-02-04 17:28:24 +01:00
[source,javascript]
----
/\u{1234}/
/\p{Alpha}/
----
=== Compliant solution
2022-02-04 17:28:24 +01:00
[source,javascript]
----
/\u{1234}/u
/\p{Alpha}/u
----