fork 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. var strings = new List<string> { "msl_0123456789_otherstuff.csv", "msl_test.xml", "anythingShort.w1" };
  12. foreach (var s in strings)
  13. {
  14. Console.WriteLine("{0} => {1}", s, new string(Regex.Replace(s, @"^msl_|\.\w{1,3}$","").Take(10).ToArray()));
  15. }
  16. }
  17. }
Success #stdin #stdout 0.08s 22400KB
stdin
Standard input is empty
stdout
msl_0123456789_otherstuff.csv => 0123456789
msl_test.xml => test
anythingShort.w1 => anythingSh