试图将负面的正则表达式放入Phing replaceregexp任务并收到错误:
BUILD FAILED
Error reading project file [wrapped: C:pathtobuild.xml:110:29: > required]
Total time: 0.4800 seconds
我看到尖括号在 xml 中是一个问题。有没有办法在构建文件中指定负面的后视正则表达式,或者这是自定义任务的东西?
我的目标是将文件中的引用重命名为".js",同时保留所有现有的".min.js"引用,使用一些不完全不同的东西:
(<script)(.*)(src=")(.*)(?<!.min)(.js")
将正则表达式拖放到属性文件中:
minify_path_regex=(<script)(.*)(src=")(.*)(?<!.min)(.js")
然后引用:
<copy todir="${builddir}/custom_errors" >
<filterchain>
<replaceregexp>
<regexp pattern="${minify_path_regex}" replace="1234.min5" />
</replaceregexp>
</filterchain>
<fileset refid="allPages" />
</copy>
但是,如果有一种方法可以绕过内联的 xml/括号问题,我仍然很想知道。