Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

oracle regex replace (keep only a-z)

Tags:

regex

oracle

I have data in last_name column.

This data comes from online and at times users are copy pasting the last name from a word document. This is a problem when a last name has a single quote. Somehow the single quote from a word document is weird.

I want to write an oracle regex replace in my select query such a way that it replaces everything in the last_name column but just keeps (a-z or A-Z).

Is this doable?

like image 325
learn_plsql Avatar asked Dec 21 '10 19:12

learn_plsql


1 Answers

finally I went with this:

REGEXP_REPLACE(mbr_last_name,'[^a-zA-Z'']','') replaced_last_name 

I'm keeping a to z A to Z and a single quote

like image 92
learn_plsql Avatar answered Oct 17 '22 11:10

learn_plsql