ColdFusion Regex 用于查找空 html 标签

发布于 2024-10-02 06:42:31 字数 294 浏览 0 评论 0原文

大家好,我正在尝试动态删除一些空的 html 标签。我对正则表达式有点陌生,似乎 Coldfusion 的引擎不像其他正则表达式引擎(如 javascript 和 as3)那样强大/相似。

在 Coldfusion 8 中构建忽略空格的正则表达式有什么技巧?因此,如果我构建这个东西,我希望它能够在下面的任何一个示例中工作。

<p > </p>
<p>         </p>
<P></p>

任何帮助都会非常感激!

Hey all, I'm trying to dynamically strip out some empty html tags. I'm kind of new to Regex, and it seems like the engine for coldfusion isn't as robust/similar to other regex engines (like javascript and as3).

What's the trick for building a regex that ignores spaces in coldfusion 8? So, if I build this thing out I want it to work on either of the examples below.

<p > </p>
<p>         </p>
<P></p>

Any help would be really greatful!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罗罗贝儿 2024-10-09 06:42:31

这应该有效:<\w+[^>]*(/>|>\s*?)。我认为。没有复杂的、语言特定的功能(即 loohaheads、lookbehinds 等)

从此处修改: 用于删除空 的正则表达式标签

This should work: <\w+[^>]*(/>|>\s*?</\w+>). I think. There are no complex, language specific features (i.e. loohaheads, lookbehinds, etc.)

Modified from here: Regular expression to remove empty <span> tags

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文