Skip to content

Not sure result of /[^\P{Lowercase_Letter}]/iu.test('A') #3592

Open
@Jack-Works

Description

@Jack-Works

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.


CompileToCharSet

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)


CharacterSetMatcher

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs dataThis PR needs more information; such as web compatibility data, “web reality” (what all engines do)…

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions