关于网友提出的“求正则表达式”问题疑问,本网通过在网上对“求正则表达式”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题:求正则表达式
解决方案1:
对于哪个例子来说不满足你的要求,不要只说不行
string test = @"
已经发送
";
Regex reg = new Regex(@"(?is)(?<=\ | ]*?class=""td-main[0-2]""[^>]*>)(.*?)(?=\)");
MatchCollection mc = reg.Matches(test);
foreach (Match m in mc)
{
richTextBox2.Text += m.Value + "\n";
} |
解决方案2: 8 楼的方法 你试了没有?
void Main()
{
string html=@"
已经发送
";
string matchString = @"(?<= | ]*class=""td-main[0-2]""[^>]*>)[^<]*?(?=)";
Regex reg = new Regex(matchString);
MatchCollection mc = reg.Matches(html);
foreach (Match m in mc)
{
Console.WriteLine(Regex.Replace(m.Value, @"[\d\s]", ""));
//已经发送
}
}
|
以上介绍了“求正则表达式”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/1449870.html