[issue36206] re.match() not matching escaped hyphens

2019-03-12 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- pull_requests: -12268 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue36206] re.match() not matching escaped hyphens

2019-03-12 Thread Ned Deily
Change by Ned Deily : -- pull_requests: +12268 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36206] re.match() not matching escaped hyphens

2019-03-12 Thread Ned Deily
Change by Ned Deily : -- pull_requests: +12265 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36206] re.match() not matching escaped hyphens

2019-03-12 Thread Ned Deily
Change by Ned Deily : -- pull_requests: -12265 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36206] re.match() not matching escaped hyphens

2019-03-05 Thread Steven D'Aprano
Steven D'Aprano added the comment: You don't escape the text you are searching. Try this: py> re.match(re.escape('-'), "-") <_sre.SRE_Match object; span=(0, 1), match='-'> py> re.match(re.escape('a-c'), "a-c") <_sre.SRE_Match object; span=(0, 3), match='a-c'> -- nosy:

[issue36206] re.match() not matching escaped hyphens

2019-03-05 Thread Josh Rosenberg
Change by Josh Rosenberg : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___

[issue36206] re.match() not matching escaped hyphens

2019-03-05 Thread Josh Rosenberg
Josh Rosenberg added the comment: "\\-" is equivalent to the raw string r"\-" (that it, it has one backslash, followed by a hyphen). \X (where X is any ASCII non-letter, non-digit) matches the character itself (the escape does nothing except ensure the punctuation doesn't have any special

[issue36206] re.match() not matching escaped hyphens

2019-03-05 Thread Lottie Price
New submission from Lottie Price : Problem: re.match("\\-", "\\-") returns None. I expected a match. Context: I have some random text strings I want to match against. I'm using re.escape() to ensure that the text characters are not interpreted as special characters: