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

Add support for possessive quantifier #260

Open
gregjacobs opened this issue Dec 28, 2018 · 2 comments
Open

Add support for possessive quantifier #260

gregjacobs opened this issue Dec 28, 2018 · 2 comments

Comments

@gregjacobs
Copy link

Hey @slevithan. First off, great library. Super helpful in overcoming some of JavaScript RegExp's shortcomings!

Would love to see support for the possessive quantifier. I know it requires the lookahead + backreference trick, and that would affect the numbered backreferences in the original regexp, but I think it might be worth it. Given that we can use named backreferences, this problem might be mitigated. Might just need a little documentation with a warning about using them. Thoughts?

@slevithan
Copy link
Owner

slevithan commented Dec 28, 2018

Yeah, it could be really useful sometimes and it’s something I’ve thought about before as well. Thanks for bringing it up here.

I prefer for XRegExp to have complete solutions that handle all edge cases, so the effect on backreference numbers that you brought up is what made me avoid this in the past. But now that XRegExp supports the /n flag for named backreferences only, I could imagine this being done really well by requiring XRegExp’s /n flag in order to support possessive quantifiers.

This still would be moderately complex to implement though because of the way XRegExp processes regex syntax, which doesn’t currently have easy support for identifying the inner contents of an arbitrary grouping that contains any number of nested groups.

@slevithan
Copy link
Owner

See also #190.

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