21 lines
648 B
Plaintext
21 lines
648 B
Plaintext
![]() |
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
|
||
|
|
||
|
----
|
||
|
/\u{1234}/
|
||
|
/\p{Alpha}/
|
||
|
----
|
||
|
|
||
|
|
||
|
== Compliant Solution
|
||
|
|
||
|
----
|
||
|
/\u{1234}/u
|
||
|
/\p{Alpha}/u
|
||
|
----
|
||
|
|
||
|
|