Link to home
Start Free TrialLog in
Avatar of philsivyer
philsivyer

asked on

replace string

Using regex_replace how can I modify strings with more than one condition.

example ..
In a column I want to change say any text with "ADMIN" to "Administrator"
and anything with say FP FINAL to FP Final - everything else stays as is.

Regards
Avatar of enachemc
enachemc
Flag of Afghanistan image

update table
set column=
case column like '%ADMIN%' then 'Administrator'
case column like '%FP FINAL%' then 'FP Final'
else column
end
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of philsivyer
philsivyer

ASKER

Thanks
unless I'm misunderstanding the requirement, I recommend NOT using the suggestion in
http:#34870266

for one, it's illegal syntax
two, if it did work

case column like '%ADMIN%' then 'Administrator'


that will change
     'This is an ADMIN account'
into
      'Administrator'

which doesn't seem correct,  similarly the other replace would also change all of the non-FP FINAL characters as well

Thanks
Thanks