sql - Oracle Regexp_replace -


i want replace 'spaces' ' & ' excluding ' | ' in regexp_replace

for ex: 'create | delete account' -> expect output 'create | delete & account'.

i m trying sql

select regexp_replace('create | delete account','\s [^\s\|\s]',' & ') dual 

but m doing wrong here. please on it.

i think want:

select regexp_replace('create | delete account', '([^\|]) ([^\|])', '\1 & \2') dual 

the logic here make replacement whenever space should occur between 2 non pipe characters. capture these characters using parentheses, , use them in replacement via \1 , \2.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -