临时表用法(子查询):
update `lishi_healthy` set title = REPLACE(title,substring(title, 1 , locate(',', title)),'') where id in( SELECT id from (SELECT id FROM `lishi_healthy` where catid =383 and title REGEXP '^[0-9]{1,2},') as TEMPTABLE);
正则中的贪婪符号( + )在正则中需要以普通字符显示,则需转义( \\+ ):
select id,content from lishi_sports_data_copy20170817 where content REGEXP '<p>体坛\\+新势力暨校园体坛风云人物评选活动已启动';
而替换的时候非正则模式不需要转义+:
update lishi_sports_data_copy20170817 set content=REPLACE(content,substring(content, locate('<p>体坛+新势力暨校园体坛风云人物评选活动已启动', content)),'');
例子:
select id,content from lishi_sports_data_copy20170817 where content REGEXP '<p>更多精彩请关注体坛\\+APP</p>';
update lishi_sports_data_copy20170817 set content=replace(content,'<p>更多精彩请关注体坛+APP</p>','');