Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL removing characters from a string

I have a column in a datawarehouse task which needs replacing these characters: "ABCDEFGHIJKLMNOPQRSTUVWXYZ\abcdefghijklmnopqrstuvwxyz" with nothing.

For example I have this form of data "88k77.22" and it should be "8877.22"

Does anyone know any particular function which can do this, or any workaround.

Thanks in advance

like image 757
Lorik Berisha Avatar asked Dec 10 '25 08:12

Lorik Berisha


1 Answers

Use a regular expression

REGEXP_REPLACE(column, '[A-Za-z]*', '')

Is '\' supposed to be included as well? Then use

 REGEXP_REPLACE(column, '[A-Za-z\]*', '')
like image 154
Joakim Danielson Avatar answered Dec 13 '25 07:12

Joakim Danielson