RegExp fails with Windows paths

Escape backslashes before creating the regexp. This works on Mac and
Windows too.