I'm trying to rebuild a website which previously had a lot of case sensitive URLs to be all lowercase. As many of these are embedded in article texts which sit within a MySQL database (actually MariaDB) I figured I would be able to do a regex replace of some sort.
I have got pretty close using the below (not sure if this is MariaDB specific):
UPDATE field_data_body SET `body_value` = REGEXP_REPLACE(`body_value`, '(href=")([^"]*)', LOWER(CONCAT('\\1','\\2')))
This finds the links and I have tested it replaces the them. However, the selected segment isn't translated to lowercase, which leads me to assume I can't use the LOWER function within the REGEXP_REPLACE function.
An example of the text might be:
Lorem ipsum dolor sit amet, <a href="/Consectetur.htm">Consectetur</a> adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
So, any suggestions how I can apply the lowercase transformation to the regex? Thanks.