I’m looking for doing a select to format some values of my table.
I started to do code but still not working:
SELECT
CASE
WHEN name ~* '.*\yfede\y.*' THEN REGEXP_REPLACE(name, '\yfede\y', 'fed.')
ELSE name
END AS nom_modifie
FROM InitialValues;
What I want is to modify on my select return value all occurrence of the words which contain "fede" with "fed." so "Federation" becomes "fed." but "Federacion" or all words which start with "Fede" should become "fed." too
2
Answers
CASE
is redundant. Use this regexpm[[:alpha:]]*fede[[:alpha:]]*M
with the query: