Update regexps to work in Windows

This change should cover both #946 and (probably) #740.  Resolves #924 and #881, and maybe others.