SELECT REGEXP_SUBSTR('mint chocolate chip', 'ch(i|o)p', 1, 1, 'c');
Output:
'chip'
SELECT REGEXP_SUBSTR('mint chocolate chip chop', ' ch(i|o)p', 1, 2, 'i');
Output:
'chop'
'chop' is the second occurrence of the match.
SELECT REGEXP_SUBSTR('mint chocolate chip', 'ch(i|o)p', 1, 1, 'c');
Output:
'chip'
SELECT REGEXP_SUBSTR('mint chocolate chip chop', ' ch(i|o)p', 1, 2, 'i');
Output:
'chop'
'chop' is the second occurrence of the match.