62,047
社区成员
发帖
与我相关
我的任务
分享
string test = "<div> <a href=\"index.html\">index </a> > <a href=\"f-4.html\">栏目一 </a> > <a href=\"f-11.html\">栏目二 </a> > <a href=\"f-95.html\">栏目三 </a> > 文章标题 </div> ";
Regex reg = new Regex(@"(?i)<a href=""f-(\d+)\.html"">栏目[^<>]*</a>[^<>]*文章标题");
Match m = reg.Match(test);
if (m.Success)
{
richTextBox2.Text = m.Groups[1].Value;
}
string test = "<div> <a href=\"index.html\">index </a> > <a href=\"f-4.html\">栏目一 </a> > <a href=\"f-11.html\">栏目二 </a> > <a href=\"f-95.html\">栏目三 </a> > 文章标题 </div> ";
Regex reg = new Regex(@"(?isn)<a href=""f-(?<id>\d+)\.html"">((?!</?a>).)*</a>((?!</?(div|a)>).)*</div>");
Match m = reg.Match(test);
if (m.Success)
{
richTextBox2.Text = m.Groups["id"].Value;
}
([10|90|95|100])
//改为
(10|90|95|100)