String parsing with variable lenght strings
On 28 Mar 2006 15:04:06 -0800, "Harlan Grove" wrote:
Ron Rosenfeld wrote...
...
Then use the regular expression formulas:
For the number:
=REGEX.MID(A1,"[0-9]+")
It works, but \d+ is more compact.
I phrased it this way for clarity, especially when comparing with the second
formula.
(means return the first series of characters that are in the class [0-9].
For the units:
=REGEX.MID(A1,"[^0-9 ]+")
It picks up the commas as well. Those could be excluded with a positive
lookahead assertion and a comma appended to the string.
For some reason, I thought each combination of value/units was in a separate
cell. If so, commas would not be an issue.
--ron
|