Guest User

Untitled

a guest
May 27th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. string sample = "1a2b3c4d";
  2. MatchCollection matches = Regex.Matches(sample, @"d");
  3.  
  4. List<string> matchesList = new List<string>();
  5.  
  6. foreach (Match match in matches)
  7. matchesList.Add(match.Value);
  8.  
  9. matchesList.ForEach(Console.WriteLine);
  10.  
  11. List<string> matchesList2 = new List<string>();
  12.  
  13. matchesList2.AddRange(
  14. from Match match in matches
  15. select match.Value
  16. );
  17.  
  18. matchesList2.ForEach(Console.WriteLine);
Add Comment
Please, Sign In to add comment