Skip to content

Negated Unicode property class \P{Han}+ matches incorrectly #91

@kolkov

Description

@kolkov

Bug Description

Negated Unicode property class \P{Han}+ matches Han characters instead of excluding them.

Reproduction

pattern := `\P{Han}+`
input := "abc中文def"

// stdlib: ["abc", "def"]  (correctly excludes Han characters)
// coregex: ["abc中文def"]  (incorrectly includes Han characters)

Expected Behavior

\P{Han} should match any character that is NOT in the Han Unicode script.
On input "abc中文def":

  • "abc" matches (not Han)
  • "中文" does NOT match (is Han)
  • "def" matches (not Han)

Actual Behavior

The entire string matches including Han characters.

Root Cause

Likely in how negated Unicode property classes are compiled in nfa/compile.go.
Need to investigate compileUnicodeClass or related Unicode handling.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions