fork(1) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8.  
  9.  
  10. String input = @"Del Mar, CA, 92014";
  11.  
  12. Regex rgx = new Regex(@"([a-zA-Z\s]*),*\s*([a-zA-Z]{2}),*\s*([0-9]{5,10})\s*");
  13.  
  14. foreach (Match m in rgx.Matches(input))
  15. {
  16. Console.WriteLine(m.Groups[1].Value);
  17. Console.WriteLine(m.Groups[2].Value);
  18. Console.WriteLine(m.Groups[3].Value);
  19. }
  20. }
  21. }
Success #stdin #stdout 0.07s 34168KB
stdin
Standard input is empty
stdout
Del Mar
CA
92014