Oracle Database String Manipulation Regular expression

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Let's say we want to replace only numbers with 2 digits: regular expression will find them with (\d\d)

SELECT REGEXP_REPLACE ('2, 5, and 10 are numbers in this example', '(\d\d)', '#')
FROM dual;

Results in:

'2, 5, and # are numbers in this example'

If I want to swap parts of the text, I use \1, \2, \3 to call for the matched strings:

 SELECT REGEXP_REPLACE ('swap around 10 in that one ', '(.*)(\d\d )(.*)', '\3\2\1\3')
 FROM dual;


Got any Oracle Database Question?