The \w in the regex string would be treated as escape sequences and must be used as raw strings inorder to not get errors.
\w