I have a table T with two columns C1 and C2.
I want to write a query as follows:
UPDATE TABLE T
SET C2 = REGEX_REPLACE(
"(REG_SUB_PART1)(REG_SUB_PART2)(REG_SUB_PART3)",
C1,
REG_SUB_PART1
)
WHERE C2="ABC";
Effectively, I want to use another column C1, let's say URL "http://www.google.com" and set C2 to be a part of it, let's say "google.com" using $3 (third part) of regex "(http://)?(www\.)?([a-zA-Z0-9]*)".
As a result, C2 should be set as "google.com".
How could it be done using MySql?
PS: Please don't concentrate on specific regex.