I am using plsql to separate parts of my text. The text: 'a^b^c^d^e'
declare
test varchar2(10);
begin
select 'a^b^c^d^e' into test from dual;
dbms_output.put_line('1. '|| regexp_substr(test, '[^^]+', 1, 1));
dbms_output.put_line('2. '|| regexp_substr(test, '[^^]+', 1, 2));
dbms_output.put_line('3. '|| regexp_substr(test, '[^^]+', 1, 3));
dbms_output.put_line('4. '|| regexp_substr(test, '[^^]+', 1, 4));
dbms_output.put_line('5. '|| regexp_substr(test, '[^^]+', 1, 5));
end;
Output:
1. a
2. b
3. c
4. d
5. e
This works as expected, until a null is found in the middle (i.e. 'a^b^^d^e'). I expect that output to be:
1. a
2. b
3.
4. d
5. e
but the actual output is:
1. a
2. b
3. d
4. e
5.
I'm not real good at regex but I am most of the way there.
Any help would be appreciated.