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 input = "CurrentTime=04/24/16 09:57:23\nsan-ls-02022;ENEXRHO;1505;{call Pm_I_AuthFailToPTSF(631706,-21,?)}\nass\nbbbb\nCurrentTime=04/24/16 09:57:23\n631706\naaa\nbbb\n";
  12. var pat = @"(?m)^CurrentTime=([^\n]*)\n([^\n]*(?:\n(?!CurrentTime=)[^\n]*)*)";
  13. var results = Regex.Matches(input, pat)
  14. .Cast<Match>()
  15. .Select(p => p.Groups[2].Value)
  16. .ToList();
  17. Console.WriteLine(string.Join("\n---\n", results));
  18. }
  19. }
Success #stdin #stdout 0.13s 24464KB
stdin
Standard input is empty
stdout
san-ls-02022;ENEXRHO;1505;{call Pm_I_AuthFailToPTSF(631706,-21,?)}
ass
bbbb
---
631706
aaa
bbb