The Solution 1 given by
Mehdi Gholam is excellent. Only thing is that
.*
given in the
regex
captures everything including
< and >
so that we get only the last number i.e. 130.0. So,
.*
has to be replaced by
[^<>]*
.
Further, after capturing all the numbers with
matches
, the captured number will be
Groups[1]
in each match. So,
Groups[2], Groups[3]
stated by OP in the comment above, may not give the correct result.
Hence, the following code can be used to set the values as required.
Regex regex = new Regex(@"\<td[^<>]*\>([^<>]*)\<\/td\>",RegexOptions.IgnoreCase | RegexOptions.Multiline);
var matches = regex.Matches(comp);
if (matches.Count==3){
string v=matches[0].Groups[1].Value;
string r=matches[1].Groups[1].Value;
string s=matches[2].Groups[1].Value;
}