Backreference : REGEXP_SUBSTR « Regular Expressions Functions « Oracle PL/SQL Tutorial






The backslash may be followed by a number.
In the backreference version, "\1" says to match the same string as was matched by the nth subexpression.

As a first example, we can use the backreference in a manner similar to the repeat operator.


SQL>
SQL> SELECT REGEXP_SUBSTR('Yababa dababa do','(ab)')
  2  FROM dual;

RE
--
ab

SQL>
SQL>
SQL> SELECT REGEXP_SUBSTR('Yababa dababa do','(ab)\1')
  2  FROM dual;

REGE
----
abab

SQL>
SQL>
SQL> SELECT REGEXP_SUBSTR('Yababa dababa do','(ab){2}') from dual;

REGE
----
abab

SQL>








18.5.REGEXP_SUBSTR
18.5.1.REGEXP_SUBSTR(x, pattern [, start [, occurrence [, match_option]]]) gets a substring of x that matches pattern, which begins at the position specified by start.
18.5.2.Regexp_Substr returns a string of data type VARCHAR2 or CLOB
18.5.3.Grouping
18.5.4.Group the letters 'ir' together by putting them in parentheses and then parenthesizing the suffix using alternation
18.5.5.Backreference
18.5.6.Search for (