fork download
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. var fonts = new[] { "Calibri Bold", "Arial Bold Italic", "Times New Roman" };
  9.  
  10. foreach(var font in fonts) {
  11. var fontName = Regex.Replace(font, "((Bold|Italic)\\s*)*$", String.Empty);
  12. Console.Out.WriteLine("{0} => {1}", font, fontName);
  13. }
  14. }
  15. }
Success #stdin #stdout 0.07s 38424KB
stdin
Standard input is empty
stdout
Calibri Bold => Calibri 
Arial Bold Italic => Arial 
Times New Roman => Times New Roman