Given a string "select * from test_1 where dt = '2015-01-01' or dt = '2015-01-02'", I would like to replace all numeric values with 0 but would like to leave test_1 as test_1 only. How do I write such a regexp_replace()?
This finds all digits not preceeded by an underscore:
Could you please explain ((?<=[^_])[0-9]+) this part in solution provided by you elaborately?
?<= -> this is a lookbehind, i.e. check if this expression [^_] (any character but no underscore) is before the next group, but don't add it to the match.
[0-9]+ -> any number of digits