I have a table containing almost 1 million points (POIs). I want to change the case of all the acronyms in the display name column I have, currently I am identifying the acronyms as any 3 letter words that are present in the column ( I know I'll have to filter the results a lot as well ).
I am currently using this query to identify the unique words that are present in the column:
select distinct SUBSTRING(name_displ FROM '([A-Z]{1}[a-zA-Z]{2}\s)') As acronym from poi
This query is returning all the unique 3 letter words that appear in the start and the middle of the name_displ
column, now I want to change these to uppercase, I know that there is the replace(string text, from text, to text)
function and the regexp_replace(source, pattern, replacement [, flags ])
function but I'm not sure how I can use them here.
So is there another way to identify 3 letter Acronyms and then change them to uppercase in PostgreSQL
?