[New-bugs-announce] [issue38294] re.escape seems to miss some importante regex characters

Ricardo Bánffy report at bugs.python.org
Fri Sep 27 13:06:37 EDT 2019


New submission from Ricardo Bánffy <rbanffy at gmail.com>:

Under Python 3.6, re.escape escapes "/"

In [1]: import re

In [2]: re.escape('http://workday.com')
Out[2]: 'http\\:\\/\\/workday\\.com'

Under 3.7 and 3.8, "/" is not escaped.

In [1]: import re

In [2]: re.escape('http://workday.com')
Out[2]: 'http://workday\\.com'

Is this change deliberate? For a minor release (3.6 to 3.7) this broke some code that generated `sed` commands to run on a remote server.

----------
components: Regular Expressions
messages: 353380
nosy: Ricardo Bánffy, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.escape seems to miss some importante regex characters
type: behavior
versions: Python 3.7, Python 3.8

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


More information about the New-bugs-announce mailing list