diff options
author | Ricardo Bánffy <rbanffy@gmail.com> | 2019-10-08 17:41:00 +0100 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2019-10-08 19:41:00 +0300 |
commit | 43f5c0c4d0a608c04c3978adb45117f3943203b7 (patch) | |
tree | 6c6bd09f428c1fb70be1bf3c466fecb4e14a4e9d | |
parent | 98043b4fcd80bdfa8cc2be1730fa2a4cf4950958 (diff) | |
download | cpython-git-43f5c0c4d0a608c04c3978adb45117f3943203b7.tar.gz |
[3.7] bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442) (GH-16647)
Prior to 3.7, re.escape escaped many characters that don't have
special meaning in Python, but that use to require escaping in other
tools and languages. This commit aims to make it clear which characters
were, but are no longer escaped.
(cherry picked from commit 15ae75d660befe643ed42eb2707a557cea97256c)
-rw-r--r-- | Doc/library/re.rst | 8 | ||||
-rw-r--r-- | Doc/tools/susp-ignored.csv | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst | 1 |
3 files changed, 7 insertions, 3 deletions
diff --git a/Doc/library/re.rst b/Doc/library/re.rst index a23e45f2eb..4245c2417f 100644 --- a/Doc/library/re.rst +++ b/Doc/library/re.rst @@ -925,8 +925,8 @@ form. This is useful if you want to match an arbitrary literal string that may have regular expression metacharacters in it. For example:: - >>> print(re.escape('python.exe')) - python\.exe + >>> print(re.escape('http://www.python.org')) + http://www\.python\.org >>> legal_chars = string.ascii_lowercase + string.digits + "!#$%&'*+-.^_`|~:" >>> print('[%s]+' % re.escape(legal_chars)) @@ -949,7 +949,9 @@ form. .. versionchanged:: 3.7 Only characters that can have special meaning in a regular expression - are escaped. + are escaped. As a result, ``'!'``, ``'"'``, ``'%'``, ``"'"``, ``','``, + ``'/'``, ``':'``, ``';'``, ``'<'``, ``'='``, ``'>'``, ``'@'``, and + ``"`"`` are no longer escaped. .. function:: purge() diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv index 35dfce2c5c..36d93a45b0 100644 --- a/Doc/tools/susp-ignored.csv +++ b/Doc/tools/susp-ignored.csv @@ -354,3 +354,4 @@ whatsnew/3.7,,::,error::BytesWarning whatsnew/changelog,,::,error::BytesWarning whatsnew/changelog,,::,default::BytesWarning whatsnew/changelog,,::,default::DeprecationWarning +library/re,,`,"`" diff --git a/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst b/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst new file mode 100644 index 0000000000..0bde8c868c --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2019-09-27-23-37-41.bpo-38294.go_jFf.rst @@ -0,0 +1 @@ +Add list of no-longer-escaped chars to re.escape documentation
\ No newline at end of file |