日期:2014-05-18  浏览次数:21017 次

正则表达式中间的部分不会写?
<br /><strong>Language:&nbsp;</strong>中间是我想要的东西</p></td></tr>

请问这个正则表达式怎么写?

其中:“中间是我想要的东西”这部分的字符串长度不确定,有可能是英文字母,数字和空格。

------解决方案--------------------
C# code
            Regex re = new Regex(@"<strong>Language:[\s\S]*?</strong>([\s\S]*?)</p>", RegexOptions.IgnoreCase);
            MatchCollection matches = re.Matches(str);
            foreach(Match match in matches)
            {
                Console.WriteLine(match.Groups[1].Value);
            }

------解决方案--------------------
C# code
        string s = @"<br /><strong>Language:&nbsp;</strong>中间是我想要的东西</p></td></tr>";
        Match match = Regex.Match(s, @"(?is)<strong>.*?</strong>(.+?)</p></td>");
        Response.Write(match.Groups[1].Value);