fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6.  
  7. public class Test
  8. {
  9. public static void Main()
  10. {
  11. var s = ">>1<< First Option For Third Variable Reply1 >>1<<\n\n>>2<< Second Option For Third Variable Reply 1 >>2<<\n\n>>3<< Third Option For Third Variable Reply 1 \n>>3<<";
  12. var rx = @"(?<=>>([0-9]+)<<).*?(?=>>\1<<)";
  13. var results = Regex.Matches(s, rx, RegexOptions.Singleline)
  14. .Cast<Match>()
  15. .Select(m => m.Value);
  16. Console.WriteLine(string.Join("\n", results));
  17. }
  18. }
Success #stdin #stdout 0.09s 20356KB
stdin
Standard input is empty
stdout
 First Option For Third Variable Reply1 
 Second Option For Third Variable Reply 1 
 Third Option For Third Variable Reply 1