I have a string that I want to extract fields from.
The string is awkward (to me anyway).
It is as follows:
018:000000000000100778,010:abcdefghij,004:xx,xx,003:bbb,017:abcdefghijklmnopq,001:x
Each 3 digit number before the : is the size of the proceeding field i.e. 018:000000000000100778 means 000000000000100778 is 18 chars long.
Unfortunately i can't control this being spewed out from my data source.
I was wondering if there was a regex type thing that would allow me to replace the 3 chars before each : with nothing i.e. 018: would become :
That way I could parse the string easily.
The values I would want from the above example would be:
000000000000100778
abcdefghij
xx,xx
bbb
abcdefghijklmnopq
x
I thought I had it working using rindex etc, but it was messy and didn't work properly.
Any help would be appreciated.
The string is awkward (to me anyway).
It is as follows:
018:000000000000100778,010:abcdefghij,004:xx,xx,003:bbb,017:abcdefghijklmnopq,001:x
Each 3 digit number before the : is the size of the proceeding field i.e. 018:000000000000100778 means 000000000000100778 is 18 chars long.
Unfortunately i can't control this being spewed out from my data source.
I was wondering if there was a regex type thing that would allow me to replace the 3 chars before each : with nothing i.e. 018: would become :
That way I could parse the string easily.
The values I would want from the above example would be:
000000000000100778
abcdefghij
xx,xx
bbb
abcdefghijklmnopq
x
I thought I had it working using rindex etc, but it was messy and didn't work properly.
Any help would be appreciated.