Created
June 7, 2019 08:56
-
-
Save edqwerty1/3daaf8afdb7c211615bc3a6ccada96f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ids = @"1,2 | |
3 | |
asf | |
4 5"; | |
Regex rx = new Regex(@"(\d+)", | |
RegexOptions.Compiled | RegexOptions.IgnoreCase); | |
MatchCollection matches = rx.Matches(ids); | |
var listIds = new List<int>(); | |
foreach (Match match in matches) | |
{ | |
listIds.Add(Convert.ToInt32(match.Value)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment