I’ve got data which looks like this…
1 TESTAAA SERNUM A DESCRIPTION
2 TESTBBB ANOTHR ANOTHER DESCRIPTION
3 TESTXXX BLAHBL
My question is, what is the most efficient way to split this data into it’s smaller substrings, as there will be hundreds of lines. Also, some of the lines will be missing the last column. I tried to do regex but wasn’t successful with the pattern I used for widths. The data above should break down into these fields (length of each column listed below)
{id} {firsttext} {serialhere} {description}
4 22 6 30+
Can anyone lend a hand or suggest a good regex matching pattern to extract the information?
Thanks,
Simon
Try the following regex:
If the values are always nonempty and separated with whitespace (that is, they don’t run into each other), then try something simpler like