mysql 正则的使用以及使用正则进行替换

查询

SELECT title FROM ims_shimmer_liveshop_goods_library WHERE title REGEXP "[^[0-9]]*[0-9]{4}g$"

修改

UPDATE ims_shimmer_liveshop_goods_library SET title = REPLACE(title,SUBSTR(title, -5, 5),"") WHERE title REGEXP "[^[0-9]]*[0-9]{4}g$"
title REGEXP "[^[0-9]]*[0-9]{4}g$"   正则匹配结尾为数字以及g的数据

你可能感兴趣的:(mysql,mysql)