在js中 过滤文件路径的正则 怎么写?求指教 希望全面点
3 回答
精慕HU
TA贡献1845条经验 获得超8个赞
public static bool CheckPath(string path)
{
string pattern = @"^[a-zA-Z]:(((\\(?! )[^/:*?<>\""|\\]+)+\\?)|(\\)?)\s*$";
Regex regex = new Regex(pattern);
return regex.IsMatch(path);
}添加回答
举报
0/150
提交
取消
