Description
For code /[^\P{Lowercase_Letter}]/iu.test('A')
, according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Character_class#complement_classes_and_case-insensitive_matching and Web reality (Chrome/Firefox/Safari), it should be false
, but true
as my understanding of the specification, I'm not sure if I read it correct.
S
is a CharSet that includes all code points that do not have the property Lowercase_Letter
, and has Simple Case Folding applied, therefore A
was originally in the CharSet (it is not a Lowercase_Letter
) but after Simple Case Folding applied, it becomes a
.
In step 3, it calls CharacterComplement on S, so a
does not appear in the returned CharSet but A
does. (let's call it S2
)
In step 2.k, the input character ch=A
and converted to cc=a
after canonicalized.
In step 2.l, it searches for a
in the CharSet S2
above, and found
is false
.
invert
is true
and found
is false
, so the match succeeds (not the same with MDN and web result).