gpt4 book ai didi

javascript - 用正则表达式替换空

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:02:07 25 4
gpt4 key购买 nike

我正在尝试使用 replace 删除空段落有正则表达式,但运气不好。

return text.replace('/(<p><\/p>)+/g', '');

I've tested the regex /(<p><\/p>)+/g in regex101似乎没问题。我做错了什么?

Reproduction online

最佳答案

您应该删除引号:

return text.replace(/(<p><\/p>)+/g, '');

关于javascript - 用正则表达式替换空 <p></p>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36313656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com