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

Why are some invalid regex-es qualified as valid? #847

Closed
Arian94 opened this issue Mar 7, 2022 · 4 comments
Closed

Why are some invalid regex-es qualified as valid? #847

Arian94 opened this issue Mar 7, 2022 · 4 comments

Comments

@Arian94
Copy link

Arian94 commented Mar 7, 2022

No description provided.

@BurntSushi
Copy link
Member

For instance, the regex adsa+* is invalid

What makes you say that? Where are you getting your definition of "valid" from?

@BurntSushi
Copy link
Member

regex101 doesn't have a Rust flavor:

regex101

so I don't see how you could use it to determine which regexes are valid for this crate and which aren't.

ads{2,8}{6}
Is this a valid regex??

Yes.

@BurntSushi
Copy link
Member

BurntSushi commented Mar 7, 2022

If Rust Regex is that different

It isn't.

In general, no two regex engines have the same set of valid regexes. And sometimes, even for two valid regexes that have equivalent concrete syntax, their behavior might be different depending on the regex engine. Additionally, Rust's regex engine also rejects some regexes that other regex engines don't. For example, a{ is typically a valid regex for most engines, but it is invalid for this one.

a book or something is substantially needed

I'm always in favor of improving docs. And I think it would be nice to have a "beginner" level tutorial focused around the regex crate. (I believe there's an issue tracking that.) But pretty much any beginner regex tutorial will be sufficient for at least learning the regex syntax and behavior in 99% of the cases. The cases you bring up here are niche, and I very strongly reject your claim that a book is "substantially" needed based on the evidence you've presented so far.

Otherwise, I'll close this in favor of #497.

@BurntSushi
Copy link
Member

See also: #765.

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

No branches or pull requests

2 participants