GeoBeez
GeoBeez

Reputation: 1014

how to remove quotes and numbers after stopwords removed from String in Postgresql

I had a table with a string column. I removed the stopwords from the string and then the result look like this (which somehow connected to this link and What @IMSoP suggested for another case)

'would':2 'yellow':4

I want to get rid of these quotes and : and the numbers. I tried

UPDATE tblName SET colName= replace(colName, '\s?[a-zA-Z]\w:\d', '');

and also this

UPDATE tblName SET colName= replace(colName, ':\d', '');

but for selection, it works but does not replace it.

Upvotes: 1

Views: 525

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1270021

How about using regexp_replace()?

UPDATE tblName
    SET colName = regexp_replace(colName, '[0-9:'']', '', 'g');

Upvotes: 1

Related Questions