MariaDb REGEXP_REPLACE not applying UCASE/UPPER in replacement

129 Views Asked by At

In the query SELECT REGEXP_REPLACE('an Der Mauer', '^([[:lower:]])', CONCAT('\\1', '-', UPPER('\\1'))); the result returned is 'a-an der Mauer', not 'a-An der Mauer' as I would expect. Am I doing something wrong, or is this a bug in the REGEXP-REPLACE() function?

1

There are 1 best solutions below

1
On

It was really too late yesterday evening! Of course, UPPER() is applied to '\\1' before \\1 is evaluated. Therefore, since each of the participating characters is its own uppercase version as well as its own lowercase version, nothing visible happens. As long as I cannot pass UPPER as a function reference I need to resolve this problem differently.