string sentence = \"X10 cats, Y20 dogs, 40 fish and 1 programmer.\"; string[] digits = Regex.Split (sentence, @\"\\D+\");
for this code i get val
Check the syntax lexers for most programming languages for a regex for decimals. Match that regex to the string, finding all matches.