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>的代码块。

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据