最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
正则字符串中含有超连接代码
时间:2022-06-25 04:26:07 编辑:袖梨 来源:一聚教程网
要判断字符串中是否有url连接代码,我们正则 @"(http|ftp|https教程)://[w]+(.[w]+)([w-.,@?・^=%&:/~+#]*[w-@?^=%&/~+#])";,下面我们用一个实例来说明。
private list
geturlfromcontent(string content)
{
string regexstr = @"(http|ftp|https)://[w]+(.[w]+)([w-.,@?・^=%&:/~+#]*[w-@?^=%&/~+#])";system.text.regularexpressions.matchcollection mc = system.text.regularexpressions.regex.matches(content, regexstr, system.text.regularexpressions.regexoptions.ignorecase);
list
urlstr = new list ();
for (int i = 0; i < mc.count; i++)
{
if(!urlstr.contains(mc[i].tostring()))
{
urlstr.add(mc[i].tostring());
}
}
return urlstr;
}
相关文章
- 江南百景图卫寻彩怎么样 江南百景图新居民卫寻彩人物介绍 05-09
- token.im钱包最新版下载 05-09
- starnetwork官网下载最新版 05-09
- 杜甫诗句“田家望望惜雨干,布谷处处催春种”中,“布谷”是指 蚂蚁庄园今日答案5月10日 05-09
- 蚂蚁庄园小鸡答题今日答案2024年5月10日 05-09
- 蚂蚁庄园每日答题答案2024年5月10日 05-09