您的位置:首页 > 其它

判断字符串是否 是url

2014-03-05 14:07 344 查看
public
static
bool
IsUrl(
string
url)
{
return
Regex.IsMatch(url,
@"^(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?$"
,
RegexOptions.IgnoreCase);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: