I'm working on a substring regular expression and I need to get all characters from a string like this:
FIRSTCOLUMN, SECONDCOLUMN, THIRDCOLUMN
So far I've got:
SELECT
REGEXP_SUBSTR('FIRSTCOLUMN, SECONDCOLUMN, THIRDCOLUMN', '[^SECONDCOLUMN]+') AS SUBSTRING
FROM DUAL;
This returns just "FIR" but I need the result to be "FIRSTCOLUMN, ".
Another example to understand better the question is:
when I have '[^THIRDCOLUMN]+' pattern instead of '[^SECONDCOLUMN]+' as the first example, I want the result to be "FIRSTCOLUMN, SECONDCOLUMN, ".
I know it is possible but I'm not good enough on regular expressions.