新闻建站cms系统、政府cms系统定制开发

广州网站建设公司-阅速公司

asp.net新闻发布系统、报纸数字报系统方案
/
http://www.ysneo.com/
广州网站建设公司
您当前位置:首页>网站技术

网站技术

C#正则Match的使用

发布时间:2015/1/30 10:09:59  作者:Admin  阅读:290  

广告:阿里云采购优惠专区

asp.net和C#正则Match的使用

Regex imgreg = new Regex(@"src=(.*)", RegexOptions.IgnoreCase | RegexOptions.Compiled);

string img1 = "";

Match MV2 = imgreg.Match(html);

while (MV2.Success)

{

//hb.Append(MV.Groups[0]);

img1 = MV2.Groups[1].ToString().Trim();

if (img1 != "")

{

Uri addr2 = new Uri(relativeLocation, img1);

html = html.Replace(MV2.Groups[1].Value, addr2.AbsoluteUri); /*复杂替换方法*/

}

MV2 = MV2.NextMatch();

}

广告:阿里云新人采购专场

相关文章
Match
正则
cms新闻系统购买咨询
扫描关注 广州阅速软件科技有限公司
扫描关注 广州阅速科技