-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed as not planned
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
According to the docs:
(...)
Matches whatever regular expression is inside the parentheses, and indicates the start and end of a group; the contents of a group can be retrieved after a match has been performed, and can be matched later in the string with the \number special sequence, described below. To match the literals '(' or ')', use\(or\), or enclose them inside a character class:[(],[)].
However, when I try to use the \( and \) literals, I get:
SyntaxWarning: invalid escape sequence '\('
return bool(re.match('^Custom\([^)]*\)$', text))Note that using the character classes [(] and [)] does work, but in my opinion re strings are hard enough to read as-is. ;-)
Tested on 3.12 and 3.13.
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error