Regular expressions: splitting with REGEXP_SUBSTR and "null"

From: citte <nicola.amerio_at_gmail.com>
Date: Thu, 28 Feb 2008 08:02:53 -0800 (PST)
Message-ID: <f6caa754-b8d0-492a-89ae-9328e2f99136@i29g2000prf.googlegroups.com>


Hi,
I have a problem, I found on internet a way to split strings separated by pipe | (for example) with regexp, something like that:

SELECT REGEXP_SUBSTR('One|Two|Three|Four','[^|]+', 1, 3) FROM dual;

which gives the result:
Three

the problem comes when I have one of the words separated by the pipe is actually a Null, so the string becomes 'One|Two||Four|'

the query

SELECT REGEXP_SUBSTR('One|Two||Four','[^|]+', 1, 3) FROM dual;

result in:
Four

I needed a Null (or empty string).
How is this possible?

Thank you in advance! Received on Thu Feb 28 2008 - 10:02:53 CST

Original text of this message