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

Fix a few regex inefficiencies #1326

Merged
merged 3 commits into from
Sep 3, 2024
Merged

Conversation

InSyncWithFoo
Copy link
Contributor

Explanations:

  • .*?$ is the same as .*: Being lazy at the end is the same as being greedy.
  • [^\-] is the same as [^-]: The - here cannot be considered a part of a range.
  • The dot in user.(name|email) acts as a metacharacter.
  • (?:(via)|(?:via (.*?))|(?: (.*?)))$ is equivalent to (?:via$|via (.*)| (.*)).
    Consequently, a line below was changed from .get(2).or_else(|| m.get(3)) to .get(1).or_else(|| m.get(2)).

@charliermarsh charliermarsh enabled auto-merge (squash) September 3, 2024 02:24
@charliermarsh charliermarsh merged commit d026370 into astral-sh:main Sep 3, 2024
7 of 8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants