How can I use regex in Postgres to replace a capture with an upper case version of itself.
regexp_replace(pf.description, '^(.)(.*)$', '\U\1\E\2', 'gi') as description
is giving me the string back with the literal values \U and \E.
There is no built-in regex functionality in Postgres to convert to upper / lower case (that I'd know of).
I would use left() and right() instead:
SELECT upper(left('test_string', 1))
|| lower(right('test_string', -1));
Result:
Test_string
\Uand\E, or do you need that literally?\Uand\Lare how I change case using regex. I am just trying to make the first letter of the string upper case.