I have to split a string with pipes as delimiter. A string like this for example:
'THIS|IS|AN|EXAMPLE'
If I do something like this:
SELECT REGEXP_SUBSTR('THIS|IS|AN|EXAMPLE', '[^|]+', 1, 4) FROM DUAL
I should obtain the word EXAMPLE
But if the string is like this:
'THIS|IS||AN|EXAMPLE'
With the above query I still get EXAMPLE, but the word should be in the next position (5) because after IS there should be an empty element
Is it possible to modify the regular expression to get also the empty element?
Thanks in advance