日期:2014-05-18  浏览次数:20817 次

正则表达式。

class="f14" title="2013年中考数学二轮专题复习之一.doc">2013年中考数学二轮专题复习之一.doc</a></td>

class="f14" title="2013年中考数学二轮专题复习之三.doc">2013年中考数学二轮专题复习之三.doc</a></td>

class="f14" title="2013年中考数学二轮专题复习之五.doc">2013年中考数学二轮专题复习之五.doc</a></td>

class="f14" title="2012佛山中考数学卷.doc">2012佛山中考数学卷.doc</a></td>

想取出其中的:
2013年中考数学二轮专题复习之一.doc
2013年中考数学二轮专题复习之三.doc
2013年中考数学二轮专题复习之五.doc
2012佛山中考数学卷.doc
这样的应该要怎么获取呢?
要全部都取出来。

------解决方案--------------------
<a\b[^>]*?class="f14"[^>]*?>(.*?)</a>
C# code

string input="HTML源码";
string pattern=@"(?is)<a\b[^>]*?class=""f14""[^>]*?>(.*?)</a>";
List<string> list=new List<string>();
foreach(Match m in Regex.Matches(input,pattern))
{
  list.Add(m.Groups[1].Value);//list就是你要的
}

------解决方案--------------------
C# code
Regex reg = new Regex(@"(?is)(?<=title="")[^""]*?(?="")");