-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Documentation on 3.6->3.7 re.escape no longer escaping "/" or ":" should be obvious #82475
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
Comments
Under Python 3.6, re.escape escapes "/" In [1]: import re In [2]: re.escape('http://workday.com') Under 3.7 and 3.8, "/" is not escaped. In [1]: import re In [2]: re.escape('http://workday.com') Is this change deliberate? For a minor release (3.6 to 3.7) this broke some code that generated |
Yes, it is deliberate. "/" and ":" do not have special meaning in regular expressions and do not need escaping. re.escape() now produces more human-readable result and works faster. |
Thanks for the clarification, Serhiy. Should we update the 3.7 docs to warn others about it? |
It is already documented. There are even examples which contain "/" and ":". |
Indeed. It was easy to miss because of the joining and sorting. Being explicit on the 3.7 changes, that '!', '"', '%', "'", ',', '/', ':', ';', '<', '=', '>', '@', '`' were up to 3.6 but are no longer escaped since 3.7, would be nice. |
Thank you for your contribution Ricardo! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: