Regex rex = new Regex("(?<=[>])([^>]*?)(?=[<])"); //第一个匹配 var match = r.Match("<p>1111</p>222222<p>33333</p><p>33333</p><p>33333</p><p>33333</p>");
string input = "<p>www.zykwd.cn</p>sdfs3333<p>eeeeee</p>"; Regex regex = new Regex(@"(?<=\<p\>).*?(?=\<\/p>)"); Match match = regex.Match(input); if (match.Success) { Console.WriteLine(match.Groups[0].Value); } Console.ReadLine();
(?<=\<p\>).*?(?=\<\/p>)
如上取得:
1111
33333
Regex rex = new Regex("(?<=[>])([^>]*?)(?=[<])");
//第一个匹配
var match = r.Match("<p>1111</p>222222<p>33333</p><p>33333</p><p>33333</p><p>33333</p>");
Regex regex = new Regex(@"(?<=\<p\>).*?(?=\<\/p>)");
Match match = regex.Match(input);
if (match.Success)
{
Console.WriteLine(match.Groups[0].Value); }
Console.ReadLine();