110,571
社区成员
发帖
与我相关
我的任务
分享
string s = " <span id='spanTest'>This is a <br /> sample! </span>";
Regex reg = new Regex(@"(?<=<span[^<]*>).*(?=</span>)");
MessageBox.Show(reg.Match(s).Value);
string strContent = @"<span id='spanTest'>This is a <br /> sample! </span>";
Regex reg = new Regex(@"(?i)(?<=<span[^>]+>).*?(?=</span>)");
Console.WriteLine("/*\n------输出结果------------");
MatchCollection mc = reg.Matches(strContent);
foreach (Match m in mc)
{
Console.WriteLine(m.Groups[0].ToString());
}
/*
------输出结果------------
This is a <br /> sample!
*/