删除mysql数据中的img 图片标签 (img到jpg之间的字符),非正则表达式

代码最初源于https://blog.csdn.net/kh6417/article/details/108056204 感谢作者 峰晨朴朴

update wp_posts set post_content = replace(post_content, substring_index(substring_index(post_content,'<img',-1),'jpg>',1) , '' )

注意:执行完毕后还会残留剩余<imgjpg>

update wp_posts set post_content = replace(post_content, '<imgjpg>','' )

同理,稍微改下,将img替换成<a 就是过滤超链接标签了

如果你是MYSQL8.0版本可以使用

MySQL的正则替换数据:REGEXP_REPLACE函数

https://blog.csdn.net/bskr84/article/details/115258900

分享到:
赞(0)