fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. string pattern = "[.]{2}[A-Z0-9]{2,4}:.*?(?=[.]{2}|$)";
  9. string input = @"
  10. ..NAME: JOHN
  11. ..BDAY: 1/1/2010
  12. ..NOTE: 1. some note 1
  13. 2. some note 2
  14. 3. some note 3
  15. ..DATE: 6/3/2014";
  16.  
  17. foreach (Match m in Regex.Matches(input, pattern, RegexOptions.Singleline))
  18. Console.WriteLine("'{0}' found at index {1}.",
  19. m.Value, m.Index);
  20. }
  21. }
Success #stdin #stdout 0.08s 34088KB
stdin
Standard input is empty
stdout
'..NAME: JOHN
' found at index 1.
'..BDAY: 1/1/2010
' found at index 14.
'..NOTE: 1. some note 1
 2. some note 2
 3. some note 3
' found at index 31.
'..DATE: 6/3/2014' found at index 86.