gpt4 book ai didi

javascript - 使用 JavaScript 正则表达式查找所有 `*.html` 但不包括 `*.tmp.html`

转载 作者:行者123 更新时间:2023-11-28 18:09:27 25 4
gpt4 key购买 nike

我有一个大型项目,其中包含许多 *.html 文件和许多 *.tpl.html 文件。

我想使用正则表达式来区分我的 Webpack 配置中的这两者。

我尝试使用惰性来实现此目的,例如 .*?\.html 但这也匹配 *.tpl.htmlhttps://regex101.com/r/a0fl4H/1

如何实现这一目标?

最佳答案

试试这个:

^(?!.*\.tpl).+\.html$

演示:

https://regex101.com/r/a0fl4H/8

关于javascript - 使用 JavaScript 正则表达式查找所有 `*.html` 但不包括 `*.tmp.html`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41935850/

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