(Feature #8657) Support UNC paths on Windows

This patch makes a couple of small logic tweaks (adjusting regexes used to clean paths) so that UNC paths can be used successfully on Windows.