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

Rust flavor produces error for valid regex #2151

Closed
gammelalf opened this issue Sep 25, 2023 · 7 comments
Closed

Rust flavor produces error for valid regex #2151

gammelalf opened this issue Sep 25, 2023 · 7 comments
Labels
feature request rust Rust language related

Comments

@gammelalf
Copy link

Bug Description

I'm assuming your using rust-lang/regex as your rust library.
(I couldn't find verification in your docs but that's what your code generation uses.)

One of its examples doesn't work on you're page.
(?-u)(?<cstr>[^\x00]+)\x00 taken from its README

Reproduction steps

Enter (?-u)(?<cstr>[^\x00]+)\x00

Expected Outcome

The ability to test strings againts this valid regex.

@gammelalf gammelalf added the bug label Sep 25, 2023
@working-name working-name added the rust Rust language related label Sep 30, 2023
@working-name

This comment was marked as outdated.

@firasdib
Copy link
Owner

You cannot disable unicode in Rust, since that caused a lot of issues. See #1208

If you have a good solution for it, I'd be happy to implement it.

@InSyncWithFoo
Copy link

InSyncWithFoo commented Oct 1, 2023

@firasdib I don't know Rust, but it seems that rust-lang/regex accepts both (?P<foo>) and (?<foo>). Currently regex101 only allows the former.

@firasdib
Copy link
Owner

firasdib commented Oct 2, 2023

I get an error with the Rust version running on regex101 - maybe I've compiled an older version?

@InSyncWithFoo
Copy link

@firasdib Probably. This snippet (written by ChatGPT) runs just as fine with either (?P<foo>) or (?<foo>).

@InSyncWithFoo
Copy link

InSyncWithFoo commented Oct 2, 2023

It seems that this feature was added recently in issue #955 and corresponding PR #956. Oh, and you might want to modify the Go flavor too, since re2 now supports (?<foo>) as well.

@firasdib
Copy link
Owner

Thank you for the info. I'll try to get to this when I get more time on my hands. Closing in favor of #2167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request rust Rust language related
Projects
None yet
Development

No branches or pull requests

4 participants