[Solved] c# should i use string with regex matchs or not


use:

string sample = "1a2b3c4d";
MatchCollection matches = Regex.Matches(sample, @"\d");

List<string> matchesList = new List<string>();

foreach (Match match in matches) 
    matchesList.Add(match.Value);

matchesList.ForEach(Console.WriteLine);

or use LINQ:

List<string> matchesList2 = new List<string>();

matchesList2.AddRange(
    from Match match in matches
    select match.Value
);

matchesList2.ForEach(Console.WriteLine);

6

solved c# should i use string with regex matchs or not