ANT:得到与propertyregex多个匹配 [英] ANT : get multiple matches with propertyregex

查看:232
本文介绍了ANT:得到与propertyregex多个匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML文件,这些(样品)行:

I have these (sample) lines in a HTML-file:

test.ABC.test
test.ABCD.test
test.ABCE.test

这ANT propertyregex:

And this ANT propertyregex :

<loadfile property="getRecords" srcFile="./index.html"/>
<propertyregex property="record" input="${getRecords}" regexp="test\.([^\.]*)\.test" select="\1" casesensitive="true" override="true" global="true" />
<echo message="${record}" />

其结果就是

ABC

不过,我想获得的所有比赛。我如何获得

But I'd like to get all matches. How can I get

ABC
ABCD
ABCE

作为结果呢?

推荐答案

不知道的propertyregex问题,但这个工程(不含蚂蚁的contrib):

Not sure about the propertyregex problem, but this works (without ant-contrib):

<target name="test">
    <loadfile property="record" srcFile="./index.html">
        <filterchain>
            <tokenfilter>
                <containsregex pattern=".*test\.([^\.]*)\.test.*" replace="\1"/>
            </tokenfilter>
        </filterchain>
    </loadfile>
    <echo message="${record}" />
</target>

这篇关于ANT:得到与propertyregex多个匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆