fork(6) 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. string pattern = @"\\.|\.+|\w+|[^\w\s]";
  12. string input = @"hello world.";
  13.  
  14. foreach (Match m in Regex.Matches(input, pattern, RegexOptions.Singleline))
  15. {
  16. Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
  17. }
  18. }
  19. }
Success #stdin #stdout 0.04s 19596KB
stdin
Standard input is empty
stdout
'hello' found at index 0.
'world' found at index 6.
'.' found at index 11.