您好,欢迎来到[编程问答]网站首页   源码下载   电子书籍   软件下载   专题
当前位置:首页 >> 编程问答 >> .NET >> 求正则表达式

求正则表达式

来源:网络整理     时间:2016/6/1 17:54:51     关键词:正则表达式

关于网友提出的“求正则表达式”问题疑问,本网通过在网上对“求正则表达式”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:

问题:求正则表达式

解决方案1:

引用 12 楼 bios8086 的回复:
试了8楼的 小猫老师!不行

对于哪个例子来说不满足你的要求,不要只说不行
            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

相关图片

相关文章