62,046
社区成员
发帖
与我相关
我的任务
分享
string input = @"<a href=""/test.jsp?id=2"" title=""新闻标题"" class=""a01"">新闻标题aaa</a>";
string pattern = @"(?i)<a[^>]*?href=(['""]?)(?<href>[^'""]*?)\1[^>]*?class=(['""]?)a01\2[^>]*?>(?<text>[^<>]*?)</a>";
Match m = Regex.Match(input,pattern);
string v1 = m.Groups["href"].Value;///test.jsp?id=2
string v2 = m.Groups["text"].Value;//新闻标题aaa