Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postgres replace characters in string

I have column with text where I need to change characters! For example

  • �ay----> need to be Day
  • �rag---->need to be Drag

So I need to replace � with character D. I try next but I get error:invalid regular expression: quantifier operand invalid

update  tableT pp set descript=(select regexp_replace(descript,'�', 'D') 
FROM 
  tableT kk where pp.id=kk.id) ;
like image 208
user238271 Avatar asked Feb 24 '15 13:02

user238271


1 Answers

update tableT pp
set descript = (select replace(descript, '�', 'D') from tableT where id = pp.id)

Why don't use replace?

like image 133
President Camacho Avatar answered Sep 20 '22 14:09

President Camacho