正则 截取固定开头结尾字符串中间的字符串
比如:class="g">topic.csdn.net/u/20091018/11/ef331a56-93f ... 2011-3-28 </span> - <a
其中以class="g">开头 ;</span> - <a结尾如何获取中间的字符串:topic.csdn.net/u/20091018/11/ef331a56-93f ... 2011-3-28 。
------解决方案--------------------
C# code
string str = "class="g">topic.csdn.net/u/20091018/11/ef331a56-93f ... 2011-3-28 </span> - <a";
Regex reg = new Regex(@"(?s)(?<=class="g">).*(?=</span> - <a)");
foreach (Match m in reg.Matches(str))
{
Response.Write(m.Value + "<br/><br/><br/><br/>");
}
//topic.csdn.net/u/20091018/11/ef331a56-93f ... 2011-3-28
------解决方案--------------------