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 josh.r
Recipients ezio.melotti, josh.r, lprice, mrabarnett
Date 2019-03-06.03:45:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
"\\-" 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 regex meaning). So your pattern is equivalent to "-". Since re.match has an implicit anchor at the beginning of the string (making it roughly like "^-"), the string "\-" doesn't match.

Use raw strings consistently for your regular expressions to reduce the number of rounds of deescaping. re.match(r"\\-", "\\-") works as you expected.
Date User Action Args
2019-03-06 03:45:20josh.rsetrecipients: + josh.r, ezio.melotti, mrabarnett, lprice
2019-03-06 03:45:20josh.rsetmessageid: <>
2019-03-06 03:45:20josh.rlinkissue36206 messages
2019-03-06 03:45:20josh.rcreate