public static bool CheckPath(string path) { string pattern = @"^[a-zA-Z]:(((\\(?! )[^/:*?<>\""|\\]+)+\\?)|(\\)?)\s*$"; Regex regex = new Regex(pattern); return regex.IsMatch(path); }