Closed
Description
Description
Using a regex with a positive lookahead sometimes crashes @ runtime. See the example in the reproduction
Reproduction
let regex = /(?=([1-9]|(a|b)))/
let input = "Something 9a"
let matches = input.matches(of: regex)
for match in matches {
print(match.output) // accessing `.output` here crashes at runtime: Thread 1: EXC_BREAKPOINT (code=1, subcode=0x225246848)
}
Stack dump
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x225246848)
Expected behavior
No crash
Environment
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx14.0
Additional information
No response