given a simple delimiter separated text database, I want to construct a regexp rule, which returns the column / field entries.
given the following two example lines
entry1 = '|123|some|string |101112 |'
entry2 = '|123|some| |101112 |'
i want to get the following output:
values1 = '123', 'some', 'string', '101112'
values2 = '123', 'some', '', '101112'
so far I’m using the following regexp and regexprep combination:
values = regexp(regexprep(entry '[\s]', ''), '\|', 'split')
which unfortunately returns the following:
values1 = '' '123' 'some' 'string' '101112' ''
values2 = '' '123' 'some' '' '101112' ''
but I want to get (no extra '' before the 123 and not extra '' after '101112'):
values1 = '123', 'some', 'string', '101112'
values2 = '123', 'some', '', '101112'
given my regexp rule, why do I get the '' at the beginning and the end? How do I have to change my regexp rule, to only return the field values?
I am not sure it is exactly what you are asking for, but you can use
strread: