This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author siddheshsathe
Recipients ezio.melotti, mrabarnett, siddheshsathe
Date 2022-03-15.08:17:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1647332277.42.0.883314287614.issue47023@roundup.psfhosted.org>
In-reply-to
Content
Python 3.9.10 (main, Jan 15 2022, 18:56:52)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.sub(r"{\w}", "\s", "Hello! {user}")
Traceback (most recent call last):
  File "/usr/lib/python3.9/sre_parse.py", line 1039, in parse_template
    this = chr(ESCAPES[this][1])
KeyError: '\\s'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.9/re.py", line 210, in sub
    return _compile(pattern, flags).sub(repl, string, count)
  File "/usr/lib/python3.9/re.py", line 327, in _subx
    template = _compile_repl(template, pattern)
  File "/usr/lib/python3.9/re.py", line 318, in _compile_repl
    return sre_parse.parse_template(repl, pattern)
  File "/usr/lib/python3.9/sre_parse.py", line 1042, in parse_template
    raise s.error('bad escape %s' % this, len(this))
re.error: bad escape \s at position 0
>>>
History
Date User Action Args
2022-03-15 08:17:57siddheshsathesetrecipients: + siddheshsathe, ezio.melotti, mrabarnett
2022-03-15 08:17:57siddheshsathesetmessageid: <1647332277.42.0.883314287614.issue47023@roundup.psfhosted.org>
2022-03-15 08:17:57siddheshsathelinkissue47023 messages
2022-03-15 08:17:57siddheshsathecreate