Answer the question
In order to leave comments, you need to log in
How to parse all digits from a C# string?
How to parse all digits from a string using only a regular expression (preferably without a loop)?
I tried like this, but it doesn't work.
string line = "12sds52124d22";
string result = new Regex("\\d+").Match(line).Value;
Answer the question
In order to leave comments, you need to log in
It would be easier to do this:
string line = "12sds52124d22";
string result = Regex.Replace(line, @"[^\d]", "");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question