[issue37106] python re.escape doesn't escape some special characters.

Karthikeyan Singaravelan report at bugs.python.org
Fri May 31 00:46:17 EDT 2019


Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:

Please consider posting text content instead of images for better accessibility. This could be due to issue29995.

➜  cpython git:(master) python3.6
Python 3.6.4 (default, Mar 12 2018, 13:42:53)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> a = r"Hello'`~world"
>>> re.escape(a)
"Hello\\'\\`\\~world"

➜  cpython git:(master) python3.7
Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 16:52:21)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> a = r"Hello'`~world"
>>> re.escape(a)
"Hello'`\\~world"

----------
nosy: +serhiy.storchaka, xtreak

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37106>
_______________________________________


More information about the Python-bugs-list mailing list