This sort of example for extracting integers from a string is common:
string input = "10 blah 20 30 nonsense 40 50";
string[] numbers = System.Text.RegularExpressions.Regex.Split(input, @"^[\d]");
But how can I account for numbers with a decimal point?
e.g.
string input = "10 blah 20 30 nonsense 40.5 50"
used with the above regular expression, unsurprisingly, the 40 and the 5 after the decimal point are split into different elements of the numbers array.
In my naivity, I thought the below would work:
string[] numbers = System.Text.RegularExpressions.Regex.Split(input, @"^[\d\.]");
But this causes the decimal point to be split into its own element of the array.
This seems like it should be so easy but I've tried all sorts of regular expressions without any success. I'm tearing my hair out - any help is greatly appreciated!