Is there an existing PL/SQL method which takes a string and returns the same string but with backslashes preceding any regexp chars?
+2
A:
Try this:
result := REGEXP_REPLACE(subject, '([$^[()+*?{\|])', '\\\1', 1, 0, 'c');
Jan Goyvaerts
2008-12-17 14:53:52
Correct me if I'm wrong I think those REGEXP_ functions are 10g only? Amnyway for Ora9 I used:owa_pattern.change(strResult,'[+,.,(,)[,*,\,^,$,|,?,{,#]','\\' || '
alansk
2008-12-18 08:48:43
REGEXP functions are new in 10g. Since the question is about regular expressions, I assumed you were working with 10g. You didn't say.
Jan Goyvaerts
2008-12-18 10:57:33
Never assume ;) Seriously tho, sorry about not mentioning the Oracle version.
alansk
2008-12-18 12:58:37