using System;
using System.Text.RegularExpressions;
public class Test
{
public static void Main()
{
string str = @"<a href=""/find/1"">testing</a>
<strong>a known text</strong>
<p>testing2</p>
<p>this paragraphs are dynamically</p>
...
<a href=""/find/2/"">testing again</a>
<a href=""/find/3/"">testing and again</a>";
var regex = new Regex(@"(?:a known text|(?<!^)\G)[\w\W]+?((?<=<a\ href="")/find/.*?(?=""))");
var result = regex.Matches(str);
foreach (Match match in result)
{
string matched = match.Groups[1].Value;
Console.WriteLine(matched);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uVGV4dC5SZWd1bGFyRXhwcmVzc2lvbnM7CnB1YmxpYyBjbGFzcyBUZXN0CnsKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKICAgIHsKICAgICAgICBzdHJpbmcgc3RyID0gQCI8YSBocmVmPSIiL2ZpbmQvMSIiPnRlc3Rpbmc8L2E+CiAgICAgICAgICAgICAgICAgICAgICAgIDxzdHJvbmc+YSBrbm93biB0ZXh0PC9zdHJvbmc+CiAgICAgICAgICAgICAgICAgICAgICAgIDxwPnRlc3RpbmcyPC9wPgogICAgICAgICAgICAgICAgICAgICAgICA8cD50aGlzIHBhcmFncmFwaHMgYXJlIGR5bmFtaWNhbGx5PC9wPgogICAgICAgICAgICAgICAgICAgICAgICAuLi4KICAgICAgICAgICAgICAgICAgICAgICAgPGEgaHJlZj0iIi9maW5kLzIvIiI+dGVzdGluZyBhZ2FpbjwvYT4KICAgICAgICAgICAgICAgICAgICAgICAgPGEgaHJlZj0iIi9maW5kLzMvIiI+dGVzdGluZyBhbmQgYWdhaW48L2E+IjsKICAgICAgICB2YXIgcmVnZXggPSBuZXcgUmVnZXgoQCIoPzphIGtub3duIHRleHR8KD88IV4pXEcpW1x3XFddKz8oKD88PTxhXCBocmVmPSIiKS9maW5kLy4qPyg/PSIiKSkiKTsKICAgICAgICB2YXIgcmVzdWx0ID0gcmVnZXguTWF0Y2hlcyhzdHIpOwogICAgICAgIGZvcmVhY2ggKE1hdGNoIG1hdGNoIGluIHJlc3VsdCkKICAgICAgICB7CiAgICAgICAgICAgIHN0cmluZyBtYXRjaGVkID0gbWF0Y2guR3JvdXBzWzFdLlZhbHVlOwogICAgICAgICAgICBDb25zb2xlLldyaXRlTGluZShtYXRjaGVkKTsKICAgICAgICB9CiAgICB9Cn0=