How do I use regular expressions in PostgreSQL to remove the end of a field matching pattern?
问题 How can I simplify this PostgreSQL? Basically I want to check if the fields end with (1) or just (1) and replace and repeat from numbers from 1-30. I assume it can be done with regular expressions somehow, but I haven't got it working. UPDATE discogs.artist_meta SET name = substr(name,0, strpos(name,' (1)')) WHERE name LIKE '% (1)'; UPDATE discogs.artist_meta SET name = substr(name,0, strpos(name,'(1)')) WHERE name LIKE '%(1)'; UPDATE discogs.artist_meta SET name = substr(name,0, strpos(name,