fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var s="This123$is'a-test";
  9. var t=Regex.Split(s, @"(?<=[a-zA-Z])(?=[^a-zA-Z])|(?<=[^a-zA-Z])(?=[a-zA-Z])");
  10. foreach(var a in t) {
  11. Console.WriteLine("'{0}'", a);
  12. }
  13. }
  14. }
Success #stdin #stdout 0.11s 24704KB
stdin
Standard input is empty
stdout
'This'
'123$'
'is'
'''
'a'
'-'
'test'