- Consecutive Occurrences
Let’s try to search for two consecutive occurrences of letters from a-z in the following example.
select regexp_substr('Australiaaaaaa','([a-z])\1', 1,1,'i') from dual;
Output: aa
([a-z]) character set a-z
\1 consecutive occurrence of any character in the class [a-z]
1 starting from 1st character in the string
1 First occurrence
i stands for case insensitive
([a-z]) character set a-z
\1 consecutive occurrence of any character in the class [a-z]
1 starting from 1st character in the string
1 First occurrence
i stands for case insensitive
Now let’s try to search for three consecutive occurrences digits from 6 to 9 in the following example.