fork download
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var s = @"this comes before selection
  9. this is on the same line %% this is the first group and it can have any character /[{3$5!+-p
  10. here is some more text in the middle
  11. this stuff is also on a line with a comment %% this is the second group of stuff !@#%^()<>/~`
  12. this goes after the selections";
  13. var result = Regex.Matches(s, @"%%\s+(.*)")
  14. .Cast<Match>()
  15. .Select(p=>p.Groups[1].Value)
  16. .ToList();
  17. Console.WriteLine(string.Join("\n", result));
  18. }
  19. }
Success #stdin #stdout 0.14s 24760KB
stdin
Standard input is empty
stdout
this is the first group and it can have any character /[{3$5!+-p
this is the second group of stuff !@#%^()<>/~`