Crash when matching LF against CRLF
Opened this issue · 0 comments
ddddxxx commented
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")