Skip to content

Crash when matching LF against CRLF #71

Description

@ddddxxx

The following code crashes, because the matched string breaks extended grapheme cluster. The range of swift string is invalid.

let source = "\r\n"
let regex = Regex("\n")
let match = regex.firstMatch(in: source)!
let matchedString = match.matchedString // crash here
XCTAssertEqual(matchedString, "\n")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions