I have a text file, each line is a string.
The most extreme could look like this:
A01B01C01D100E500F100.00G100.00H100.00
A little information about possibilities:
- Each string will include at least one of those letters and a number
- the numbers following the letters can be any number of digits and places past the decimal.
- The letters are not always in order
Another example of the data:
A01B400C62.578D77.297
C62.409D77.222
C62.259D77.113
C62.135D76.975
C62.042D76.815
C61.985D76.638
C61.973D76.529
A03B10000
A0C62.760 D77.336
A0E3.000
A01F400E0
A01B400E-0.100
What I would like to do is split the string at each letter, and taking all of the numbers until the next letter. With results like so:
A01, B01, C01, D100, E500, F100.00, G100.00, H100.00
I have tried a bunch of things, and the closest I have gotten is this
dicedLine = myLine.split(/[ABCDEFGH]/)
This gives me CLOSE to what I want, except I have found that if you have a string that does not include one of those letters in the search, then the results are not what I am after.
For example a line like this:
A30
Will give me results like this:
["", "30"]
Where I would really want results like this:
["A30", "", "", "", "", "", "", ""]
Any ideas are appreciated!
"D62.409C77.222"result in["", "", "C77.222", "D62.409", "", "", "", ""]? Can you be more specific?["A30", "", "", "", "", "", "", ""]instead of["A30"]or evenSet ["A30"]?Set. But then you say you also want the blanks - which doesn't make sense if you are not interested in the indices...