rust-lang/regex

Why are some invalid regex-es qualified as valid?

Arian94 opened this issue · 4 comments

Why are some invalid regex-es qualified as valid?

For instance, the regex adsa+* is invalid

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

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.

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.

See also: #765.