C#正则表达式判断URL是否正确
C# 全选
/// <summary>
/// C#正则表达式判断URL是否正确
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
private bool IsUrl(string url)
{
var express = @"^(https?|ftp|file|ws)://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?$";
Regex r = new Regex(express);
var b = r.IsMatch(url);
return b;
}
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网