fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string pattern = @"(?x)Required\sDate
  9. (?<Line>__
  10. (?<PartNo>[a-zA-Z0-9-]*\s[0-9.]+)
  11. )*";
  12. string str = @"__Required Date__40X0343 1.00__C734X77G 2.00__Net Order:__Sales Tax:__Freight:__Order Total:__0.00 __0.00 __5,328.50 __5,328.50 __or by fax";
  13. Regex regex = new Regex(pattern);
  14. MatchCollection matchColl = regex.Matches(str);
  15. if (matchColl != null)
  16. foreach (Match match in matchColl)
  17. foreach (Capture c in match.Groups["PartNo"].Captures)
  18. Console.WriteLine(c.Value);
  19. }
  20. }
Success #stdin #stdout 0.04s 134592KB
stdin
Standard input is empty
stdout
40X0343 1.00
C734X77G 2.00