正则表达式文件路径验证
[csharp]/// <summary>
/// 文件路径验证
/// </summary>
/// <remarks>
/// 创建人:zhujt<br/>
/// 创建日期:2012-08-24 21:57:07
/// </remarks>
/// <param name="path"></param>
/// <returns></returns>
public static bool CheckPath(string path)
{
string pattern = @"^[a-zA-Z]:(((\\(?! )[^/:*?<>\""|\\]+)+\\?)|(\\)?)\s*$";
Regex regex=new Regex(pattern);
return regex.IsMatch(path);
}
补充:软件开发 , C# ,