62,271
社区成员
发帖
与我相关
我的任务
分享Regex reg = new Regex(@"(?i)<dd><span[^>]*>([^<]*)</span>([^<]*)</dd>");Regex reg = new Regex(@"(?i)<dd><span[^>]*>([^<]*)</span>([^<]*)</dd><");string test = @"<dl><dd><span class='l'>电子邮件:</span>yangsi7@163.com</dd></dl><dl>
<dd><span class='l'>姓名:</span>张三</dd></dl>";
Regex reg = new Regex(@"<span[^>]*>([^<]*)</span>([^<]*)</dd>");
MatchCollection mc = reg.Matches(test);
foreach (Match m in mc)
{
richTextBox2.Text += m.Groups[1].Value + "\n";
richTextBox2.Text += m.Groups[2].Value + "\n-----------\n";
}
/*------输出------
电子邮件:
yangsi7@163.com
-----------
姓名:
张三
-----------
*/