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

regex Crate Does not Support look-around #19

Open
theory opened this issue Jul 17, 2024 · 0 comments
Open

regex Crate Does not Support look-around #19

theory opened this issue Jul 17, 2024 · 0 comments

Comments

@theory
Copy link

theory commented Jul 17, 2024

I used regex-info to build an ECMAScript regex to match Unix-style relative file paths. To prevent .. from appearing at the start, I used a look-ahead assertion, ^(?![.]{2}\/). Alas, the regex crate does not support look-arounds:

The regex syntax supported by this crate is similar to other regex engines, but it lacks several features that are not known how to implement efficiently. This includes, but is not limited to, look-around and backreferences.

I'm just getting familiar with Rust myself, but in poking around, like in rust-lang/regex#841, it looks like the solution is to use fancy_regex instead. I wonder if that would make sense here, or if using something like ecma_regex would be more appropriate…

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

1 participant