mysql正则表达式替换字符串

mysql的replace函数是不支持正则表达式的,实现正则表达式替换字符串这样的功能需要使用下面的操作

//删除字段中(xxx)字符串
update `ctr_costomer_contact` set bill_number = replace(bill_number, substring(bill_number, locate('(', bill_number),locate(')', bill_number)-locate('('+1, bill_number)),'') where  `bill_number` REGEXP '[^ -~]' =1;

//删除字段中(xxx)字符串
update `ctr_costomer_contact` set bill_number = replace(bill_number, substring(bill_number, locate('(', bill_number),locate(')', bill_number)-locate('('+length(')'), bill_number)),'') where `bill_number` REGEXP '[^ -~]' =1;

//mysql使用正则表达式查询字段是否包含中文

SELECT *
FROM `ctr_costomer_contact`
WHERE `bill_number`
REGEXP '[^ -~]' =1