Use more robust regexp for path separator matching