Crash on call regex.match(string)
Hello,
let myRegex = try Regex("/some/([\\w\\d\\s,]+)/ig")
caused:
error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0). The process has been returned to the state before expression evaluation.
when call:
myRegex.match("/some/some123 some")
In the Python this regex pattern:
r"/some/([\w\d\s,]+)"
work perfect
I'm unable to reproduce the crash with
func testCrash() {
let myRegex = try! Regex("/some/([\\w\\d\\s,]+)/ig")
print(myRegex.match("/some/some123 some"))
}
I am getting the following output
[Regex.RegexMatch(match: "some/some123 some", range: Range(1..<18), groups: ["some123 some"], groupRanges: [Range(6..<18)])]
Could you provide the Regex, Swift language, Swift compiler, and Xcode versions you are using?
regex: this
swift -v: Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1), Target: x86_64-apple-darwin18.2.0
swiftc -v:
Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1), Target: x86_64-apple-darwin18.2.0
xcode: Version 10.1 (10B61)
Can you try the regex /\\/some\\/([\\w\\d\\s,]+)/ig?
If that doesn’t work I’ll need a minimal sample program that crashes to debug the issue.