To explain the above solution - the \W is the regexp for 'nonalphanumeric character' whereas you presumably want to tell it literal \ and literal W. So the '\' is being "escaped" by a backslash to load it correctly into the regexp engine.
Update: I am explaining the solution, but that doesn't mean I am certain it's the right solution, although, as I later replied below, it is more the problem than the solution I am doubting!