fork(3) download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. Regex regex = new Regex(@"\b\d{4}-\d{3,4}\b");
  10. foreach (Match match in regex.Matches("9000-001 a 9999-999")) {
  11. Console.WriteLine("Encontrei '{0}' na posição {1}", match.Value, match.Index);
  12. }
  13. }
  14. }
Success #stdin #stdout 0.03s 134592KB
stdin
Standard input is empty
stdout
Encontrei '9000-001' na posição 0
Encontrei '9999-999' na posição 11