我试着去数行“ 这是否buildlist需要编译:真 ”的出现次数的数量在一个文件中。 我想下面的代码,但它不会拿起计数
<concat>
<fileset file="@{logPathInTestSetup}" />
<filterchain>
<tokenfilter>
<ct:countfilter property="noOfCompiledBuildlists" contains="Does this buildlist need compile:\s*(true)" override="true">
<ct:counteach propertyprefix="count." select="\1" />
</ct:countfilter>
</tokenfilter>
<ct:stopfilter />
</filterchain>
</concat>
当我尝试计数“这是否buildlist需要编译”,柜台工作,我得到正确的值。 所以肯定是有使用正则表达式的问题。 是否有人可以帮助? 谢谢,Aarthi
你并不需要一些额外的任务,但蚂蚁1.7.1+为<concat>
必须是资源。
下面是从稍微适应例如蚂蚁手动resourcecount
给定的输入,foobar.txt:
Does this buildlist need compile: true
whatever
Does this buildlist need compile: false
The quick brown fox
jumps over the lazy dog
Does this buildlist need compile: true
Does this buildlist need compile: false
Does this buildlist need compile: true
foo
blablabla
Does this buildlist need compile: true
例如ant脚本:
<project>
<property name="file" value="foobar.txt"/>
<resourcecount property="file.lines">
<tokens>
<concat>
<filterchain>
<linecontainsregexp>
<regexp pattern="Does this buildlist need compile:\s*(true)"/>
</linecontainsregexp>
</filterchain>
<fileset file="${file}"/>
</concat>
</tokens>
</resourcecount>
<echo>The file '${file}' has ${file.lines} lines.</echo>
</project>
输出:
[echo] The file 'foobar.txt' has 4 lines.
编辑
为了获得不匹配的线,意味着否定你的正则表达式,只需使用:
</linecontainsregexp negate="true">