Regex icon indicating copy to clipboard operation
Regex copied to clipboard

Crash on call regex.match(string)

Open iDevPro opened this issue 7 years ago • 3 comments

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

iDevPro avatar Jan 27 '19 21:01 iDevPro

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?

DavidSkrundz avatar Jan 28 '19 00:01 DavidSkrundz

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)

iDevPro avatar Jan 28 '19 15:01 iDevPro

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.

DavidSkrundz avatar Jan 28 '19 23:01 DavidSkrundz