Skip to content

gh-133306: Support \z as a synonym for \Z in regular expressions #133314

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 5 commits into from
May 3, 2025

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented May 2, 2025

Copy link
Contributor

@sethmlarson sethmlarson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Serhiy. I only had one thought on this PR:

@@ -49,7 +49,8 @@
r"\S": (IN, [(CATEGORY, CATEGORY_NOT_SPACE)]),
r"\w": (IN, [(CATEGORY, CATEGORY_WORD)]),
r"\W": (IN, [(CATEGORY, CATEGORY_NOT_WORD)]),
r"\Z": (AT, AT_END_STRING), # end of string
r"\z": (AT, AT_END_STRING), # end of string
r"\Z": (AT, AT_END_STRING), # end of string (deprecated)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use "deprecated" language here if we're not deprecating \Z?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What words do you suggest? "legacy"? "obsolete"?

Due to its subtle difference from other common implementations, it is very likely that \Z will be deprecated and removed in future, when it will be safe. It is kept for compatibility with older Python versions.

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! Please also run the buildbots before merge.

@serhiy-storchaka
Copy link
Member Author

Thank you for review. This feature is not platform-depended, so no need to spend the time and the resources on running the buildbots.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) May 3, 2025 07:30
@serhiy-storchaka serhiy-storchaka merged commit ac56f8c into python:main May 3, 2025
39 checks passed
@serhiy-storchaka serhiy-storchaka deleted the re-z branch May 3, 2025 09:41
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.

4 participants