mysql正则替换html代码

在mysql中没有正则替换函数。
用下面的代码可以实现类似正则替换的效果

update youtable set content = replace(content,substring(content,locate(’<div’,content),locate(’>’,substring(content,locate(’<div’,content)))),’’)

说明:
在表youtable的content字段中有内容"

mysql正则替换html代码
"
要把div的内容去掉只保留"mysql正则替换html代码" 。

如果有多个div 需多次替换。

猜你喜欢

转载自blog.csdn.net/myhkhk/article/details/121574776