The following regular expression simply extracts a piece of matching text using callback numbers:
SELECT regexp_replace('ABCDEFGHIJ','(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)','\2');
B
But how to draw a conclusion beyond the ninth matched substring?
The following actions will not work (returns the first match + 0), and use 10 or $ {10}:
SELECT regexp_replace('ABCDEFGHIJ','(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)(\w)','\10')
A0
Note. This example was simplified for clarity and, of course, did not necessarily go beyond the backlink.
source
share