fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. string str = @"<a href=""/find/1"">testing</a>
  8. <strong>a known text</strong>
  9. <p>testing2</p>
  10. <p>this paragraphs are dynamically</p>
  11. ...
  12. <a href=""/find/2/"">testing again</a>
  13. <a href=""/find/3/"">testing and again</a>";
  14. var regex = new Regex(@"(?:a known text|(?<!^)\G)[\w\W]+?((?<=<a\ href="")/find/.*?(?=""))");
  15. var result = regex.Matches(str);
  16. foreach (Match match in result)
  17. {
  18. string matched = match.Groups[1].Value;
  19. Console.WriteLine(matched);
  20. }
  21. }
  22. }
Success #stdin #stdout 0.07s 34272KB
stdin
Standard input is empty
stdout
/find/2/
/find/3/