Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT Simplify inefficient regex #31603

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lesteve
Copy link
Member

@lesteve lesteve commented Jun 20, 2025

Got this through a CodeQL alert

@lesteve lesteve added the Quick Review For PRs that are quick to review label Jun 20, 2025
Copy link

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 06b9495. Link to the linter CI: here

@adrinjalali
Copy link
Member

Can you explain the change to a non-regex wizard?

@lesteve
Copy link
Member Author

lesteve commented Jun 20, 2025

The main thing is to simplify the nested regex "(([A-Za-z]+\-?)+)" to ([A-Za-z-]+) which is good enough for our purposes. The rest of the changes is to remove parentheses because we are not using the match groups in the code.

More context we want to find the project name and version in the README.rst lines like these ones:

.. |JoblibMinVersion| replace:: 1.2.0
.. |ThreadpoolctlMinVersion| replace:: 3.1.0
.. |Scikit-ImageMinVersion| replace:: 0.19.0
.. |PandasMinVersion| replace:: 1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
No Changelog Needed Quick Review For PRs that are quick to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants