Your regular expression is equivalent to \W* . It matches 0 or more non-alphanumeric characters.
In fact, you are using the python string literal instead of the raw string. In the python string literature, to match a literal backslash, you need to avoid the backslash - \\ , since there is a backslash here. And then for regular expression you need to escape and with a backslash to do this - \\\\ .
So, to match \ followed by 0 or more W , you will need \\\\W* in a string literal. You can simplify this by using a raw string. Where a \\ will match the literal value \ . This is because the backslash is not handled in any special way when used inside an unprocessed string.
The following example will help you understand the following:
>>> s = "\WWWW$$$$"
source share