Skip to content

fix: add r strings for regex escape #313

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

Merged
merged 1 commit into from
May 22, 2025
Merged

Conversation

gabor-boros
Copy link
Member

Reason for the change
If applicable, link the related issue/bug report or write down in few sentences the motivation.

Description
A clear and concise description of what did you changed and why.

Code examples
If applicable, add code examples to help explain your changes.

Checklist

References
Anything else related to the change e.g. documentations, RFCs, etc.

@lsabi
Copy link
Contributor

lsabi commented May 1, 2025

I'm a little confused about the interpretation/syntax of regex in python.

According to https://stackoverflow.com/questions/2241600/python-regex-r-prefix, the special characters need to be escaped, if the regex is prefixed with r (e.g. r'\w') in order to match something else than the literal string \w. Thus, it should be r\\w.

Therefore, also the regex need to be changed, in order to obtain the same result, don't they?

@gabor-boros gabor-boros deleted the gabor-boros-patch-1 branch May 21, 2025 18:20
@gabor-boros gabor-boros restored the gabor-boros-patch-1 branch May 22, 2025 06:06
@gabor-boros gabor-boros reopened this May 22, 2025
@gabor-boros
Copy link
Member Author

@lsabi We do want to use the regex \w that is matching for the word meta character. We do not want to escape it.

@gabor-boros gabor-boros merged commit 339cd9a into master May 22, 2025
@gabor-boros gabor-boros changed the title refactor: add r strings for regex escape fix: add r strings for regex escape May 22, 2025
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