下面是一种实现方式,仅仅筛选出 www.xxx.com/upload/、www.xxx.com/news/333.html 之类的网址:

UPDATE `test_table` SET `body`=REPLACE(`body`, 'www.xxx.com', 'test.xxx.com') WHERE `body` REGEXP 'www\.xxx\.com/[a-zA-Z]+'