I want to convert a string ___abc_[_]xyz to ...abc.\_xyz using regular expression.
Is it possible to convert _ and [_] into . and \_ respectively in the same query?
This is what I have done so far:
SELECT regexp_replace('___abc_[_]xyz','\[(.)\]','\\\1','g');
and
SELECT regexp_replace('___abc_[_]xyz','\[_\]','\_','g');
The Result of both queries is: ___abc_\_xyz
regexpfunctions do not accept callback functions as replacement arguments.