The expression is:
re.search("(%s)\\(%d)([0-9]+)".format(newspaper, year2))
where newspaper
is a string and year2
is an integer.
Instead of interpreting \\
as an escape to the \
character, PyCharm interprets this as escaping (
and warns that I have an unmatched closing parenthesis in (%d)
. It also highlights the opening parenthesis in orange as well. When I replaced this with \\\
, there is no warning but I'm not able to find my matches with this regex.
Is this how \
supposed to be escaped or am I missing another character?