fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string data = "some statement\n"+
  9. "token\n"+
  10. "content1\n"+
  11. "some other statement\n"+
  12. "some othe statement 2\n"+
  13. "token\n"+
  14. "content2\n"+
  15. "continutes\n"+
  16. ".....\n";
  17.  
  18. Regex r = new Regex("(?<=\\ntoken\\n).*");
  19.  
  20. Match m = r.Match(data);
  21. int matchCount = 0;
  22. while (m.Success)
  23. {
  24. Console.WriteLine("Match"+ (++matchCount) + " = '" + m.Value + "'");
  25. m = m.NextMatch();
  26. }
  27. }
  28. }
Success #stdin #stdout 0.1s 24688KB
stdin
Standard input is empty
stdout
Match1 = 'content1'
Match2 = 'content2'