How to seperate the number from this string using regex
4645sgdfghdf - 4645
sdfd544545 - 544545
54sdfsdfsdf -...
fdsfd54556 -...
wetregdfg859665 - ...
56453546dfghff - ....
251fdgfdg6 - 2516
Any help is much appreciated.. Thanks in advance
PJ MartinsPosted May 28, 2010, 10:51 AM
string input = @"4645sgdfghdf - 4645
sdfd544545 - 544545
54sdfsdfsdf -...
fdsfd54556 -...
wetregdfg859665 - ...
56453546dfghff - ....
251fdgfdg6 - 2516";
// extract all numbers
MatchCollection mcNumbers = Regex.Matches(input, "\d+");