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

Support for Possessive Repetitions #513

Open
DecimalTurn opened this issue Sep 27, 2024 · 0 comments
Open

Support for Possessive Repetitions #513

DecimalTurn opened this issue Sep 27, 2024 · 0 comments

Comments

@DecimalTurn
Copy link

DecimalTurn commented Sep 27, 2024

At the moment, possessive repetitions (aka. possessive qualifiers) are not supported by RE2:

Possessive repetitions:
x*+zero or more x, possessive
x++one or more x, possessive
x?+zero or one x, possessive
x{n,m}+n or ... or m x, possessive
x{n,}+n or more x, possessive
x{n}+exactly n x, possessive

Are there any plans for supporting possessive repetitions in the future? I understand that RE2 has no intentions to support lookarounds as expressed here because it forces the use of backtracking, but possessive qualifiers are exactly the opposite and are in line with that philosophy.

For additional motivation regarding this, it is currently impacting the way Search works on GitHub. Search is using Enry (as mentioned in this blog post) which relies on RE2. However, the regexes used for identifying the programming language used in a file are based on user-submitted regexes from Github-Linguist which uses the Oniguruma flavor of regex (and has possessive qualifiers support). This can lead to weird inconsistencies for GitHub users.

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