Skip to content

Simple word boundary disagrees with \w for digits #901

Open

Description

@robertmorelli

issue:

With Unicode-scalar matching and simple word boundaries, \w treats 0 as a word character, but \b treats it as non-word.

repro:

import Foundation
let a = try! Regex(#"\w\b\w"#).matchingSemantics(.unicodeScalar).wordBoundaryKind(.simple)
let b = try! Regex(#"0\b"#).matchingSemantics(.unicodeScalar).wordBoundaryKind(.simple)
print((try! a.firstMatch(in: "a0")) != nil)
print((try! b.firstMatch(in: "0")) != nil)

expected:

false, then true.

actual:

true, then false.

system:

Swift 6.4, macOS 27.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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