在js中 過濾文件路徑的正則 怎么寫?求指教 希望全面點
關于過濾文件路徑的正則表達式
慕容3067478
2018-07-17 19:34:44
TA貢獻1845條經驗 獲得超8個贊
public static bool CheckPath(string path)
{
string pattern = @"^[a-zA-Z]:(((\\(?! )[^/:*?<>\""|\\]+)+\\?)|(\\)?)\s*$";
Regex regex = new Regex(pattern);
return regex.IsMatch(path);
}舉報