Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on call regex.match(string) #4

Open
iDevPro opened this issue Jan 27, 2019 · 3 comments
Open

Crash on call regex.match(string) #4

iDevPro opened this issue Jan 27, 2019 · 3 comments

Comments

@iDevPro
Copy link

iDevPro commented Jan 27, 2019

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

@DavidSkrundz
Copy link
Owner

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?

@iDevPro
Copy link
Author

iDevPro commented Jan 28, 2019

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)

@DavidSkrundz
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants