fork download
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. using System.Text.RegularExpressions;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. var regex = @"[0-9]+|\b(?:\p{Lu}+\b|\w)";
  11. var list = new List<string> {"Freestyle steel","Freestyle Alloy","Trekking steel uk","Single speed","5 speed","15 speed","3 Speed internal gear with 55 coaster","MTB steel","Junior MTB"};
  12. foreach(var data in list)
  13. {
  14. var matches = Regex.Matches(data, regex).Cast<Match>().Select(m => m.Value.ToUpper());
  15. Console.WriteLine(string.Join("", matches));
  16. }
  17. }
  18. }
Success #stdin #stdout 0.04s 134848KB
stdin
Standard input is empty
stdout
FS
FA
TSU
SS
5S
15S
3SIGW55C
MTBS
JMTB