蚂蚁替换令牌如何忽略新行?

时间:2018-01-02 22:26:14

标签: ant

我在搜索时复制文件,并使用replaceregex标签替换ant中的标记 令牌存在于propertiesfile

中指定的单独文本文件中
token1=SDF234\n1sdfad
token2=FooBarBaz\nBar

config.ini文件的替换值为:$ {token1}

有些令牌中有\ n,而replaceregex添加了新行 我试着添加:byline =" true"没有成功
我还添加了flags =" m"对于replaceregex标签,它没有工作

示例令牌:

QWpVsL2Ti\njWhT\n

代码替换为:

 QWpVsL2Ti
 jWhT

所需的替换应该在同一行,忽略\ n

蚂蚁任务:

        <copy file="../../config.ini" tofile="./Package/config.ini">
                <filterchain>
                <replaceregex pattern="\$\{" replace="{" byline="true"/>
                    <filterreader classname="org.apache.tools.ant.filters.ReplaceTokens">
                            <param type="propertiesfile" value="properties_${build_target}.ini"/>
                            <param type="tokenchar" name="begintoken" value="{"/>
                            <param type="tokenchar" name="endtoken" value="}"/>
                    </filterreader>
                </filterchain>
            </copy>

0 个答案:

没有答案