Skip to content

fix: add r strings for regex escape#313

Merged
gabor-boros merged 1 commit into
masterfrom
gabor-boros-patch-1
May 22, 2025
Merged

fix: add r strings for regex escape#313
gabor-boros merged 1 commit into
masterfrom
gabor-boros-patch-1

Conversation

@gabor-boros

Copy link
Copy Markdown
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

lsabi commented May 1, 2025

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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