Hi
I need to extract the nth occurrence of a pattern in a string and I thing regexpr_substr can help me. The pattern is any string between a separator character (for example a semicolon )
Examples:
String | If I use... | I get |
---|
a;b;c | regexp_substr('a;b;c','[^*;]+',1,3) to get the 3rd occurrence | c, and it's ok |
a;b;c;;d (there are two colons between c and d) | regexp_substr('a;b;c;;d','[^*;]+',1,4) to get the 4th occurrence | d, and I expected a null |
Is there a way to obtain what I expect using regexp_substr? I used to do this with instr and substr but I wonder if there is a better way.