Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,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))
Expand All @@ -955,7 +955,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()
Expand Down
1 change: 1 addition & 0 deletions Doc/tools/susp-ignored.csv
Original file line number Diff line number Diff line change
Expand Up @@ -356,3 +356,4 @@ whatsnew/changelog,,::,default::BytesWarning
whatsnew/changelog,,::,default::DeprecationWarning
library/importlib.metadata,,:main,"EntryPoint(name='wheel', value='wheel.cli:main', group='console_scripts')"
library/importlib.metadata,,`,loading the metadata for packages for the indicated ``context``.
library/re,,`,"`"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add list of no-longer-escaped chars to re.escape documentation