As we've seen, a backslash \ is used to denote character classes, e.g. \d . So it's a special character in regexps (just like in regular strings).
Is backslash a character?
Alternatively referred to as a backward slash, downward slash, and reverse solidus, the backslash is a character ( \ ) first introduced by Bob Bemer in 1960. Although "slash" is most often used to describe the forward slash, it can describe either a forward slash or backslash.
Is backslash a special character in Python?
In Python strings, the backslash "\" is a special character, also called the "escape" character. It is used in representing certain whitespace characters: "\t" is a tab, "\n" is a newline, and "\r" is a carriage return. Conversely, prefixing a special character with "\" turns it into an ordinary character.