Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Regular Expressions Functions
 

Backreference

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> SELECT REGEXP_SUBSTR('Yababa dababa do','(ab)\1')   2  FROM dual; REGE ---- abab SQL> SQL> SELECT REGEXP_SUBSTR('Yababa dababa do','(ab){2}') from dual; REGE ---- abab SQL>