在MySQL中用正则表达式替换数据库中的内容的方法

很文博客hinvn.com 数据库评论51字数 331阅读模式
广告也精彩

将comment表中的author_url包含www.sohu.com的记录,其中的sohu替换为sina,一个语句搞定~
update comment set author_url=REPLACE(author_url,'sohu','sina') where author_url REGEXP 'www.sohu.com';

带IF判断的复杂替换文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/62877.html

update comment set url=IF(url REGEXP 'test.yahoo.com.cn',REPLACE(url,'www1.sohu.com','www.sina.com'),REPLACE(url,'www2.yahoo.com','www.sina.com')) where 1=1;文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/62877.html

文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/62877.html文章源自很文博客https://www.hinvn.com/很文博客-https://www.hinvn.com/62877.html

工具:作品在线观看

女优:最新作品观看

中文:国语在线观看

weinxin
我的微信
扫一扫更精彩
大家的支持是我更新的动力!!!
 
广告也精彩
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:
确定

拖动滑块以完成验证