postgres中通过正则删除html标签/strip html tags in postgres

先上代码

regexp_replace("source_html",'\s*(<[^>]+>|<script.+?<\/script>|<style.+?<\/style>)\s*','','gi')

作用,使用regexp_replace函数,清理html标签,也包括整个<script>…</script>, <style>…</style>的代码块。

Last Updated on 2021/07/01

发表评论

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理