Search code examples
sqlpostgresqlpostgis

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) ;

Solution

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

    Why don't use replace?