Reputation: 1326
Hi I need to write a regex with following logic:
Split at every second comma except if the character '\' is before the comma.
Maybe an example to make it clear:
1,1a,2,2a,3,3a\,b,4,4a
Should get the result:
1,1a
2,2a
3,3a\,b
4,4a
This is my following code:
SELECT REGEXP_SUBSTR (text, '[^,]+,[^,]+', 1, LEVEL) TXT
FROM DUAL
CONNECT BY REGEXP_SUBSTR (text, '[^,]+,[^,]+', 1, LEVEL) IS NOT NULL;
So my regex at the moment is: '[^,]+,[^,]+'
which split at every second comma.
Upvotes: 1
Views: 1931