日期:2014-05-18 浏览次数:20887 次
Regex re = new Regex("(?<=<title>).*?(?=</title>)", RegexOptions.None); MatchCollection mc = re.Matches("你的字符串"); foreach (Match ma in mc) { //ma.Value就是你要的值 }
------解决方案--------------------
(?<=<title[^<>]*?>)(?<content>[^<]*?)(?=</title>)
------解决方案--------------------
Regex re = new Regex("(?<=<title>).*?(?=</title>)", RegexOptions.None); MatchCollection mc = re.Matches("<title><div>afdadfa</div></title>"); foreach (Match ma in mc) { Response.Write( Server.HtmlEncode(ma.Value)); } //引用1楼
------解决方案--------------------