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

ordering of match alternatives matters #327

Open
faceprint opened this issue Sep 21, 2024 · 0 comments
Open

ordering of match alternatives matters #327

faceprint opened this issue Sep 21, 2024 · 0 comments

Comments

@faceprint
Copy link

In the example regex (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?:r?uary|ch|il|e|y|ust|tember|ober|ember)? +\d{1,2} +\d{4} (which I acknowledge is sloppy since it matches Febtember) having the e alternative before ember causes it not to match November or December as a month. I don't know if this is strictly "correct" behavior, but this works in every other regex engine I've tried.

The workaround of (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?:r?uary|ch|il|ust|tember|ober|ember|e|y)? +\\d{1,2} +\\d{4} does work in CTRE.

regex101 link

godbolt link

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