ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From neo anderson <>
Subject using RE with newline problem
Date Tue, 11 Mar 2008 15:13:00 GMT

I use ant script to load a file similar to (its format
looks like 'key = value')

One of its value looks like key = 'value' (value surrounded with the single

So I use filterchain to get rid of it, code snippet as follow:

        <loadfile srcfile="file.txt" property="temp.param">
                                <contains value="key = "/>
                                <stringtokenizer delims="="/>
                                <replaceregex pattern="('{1})" replace=""/>
                                <replaceregex pattern="('{1})" replace=""/>
                                <replaceregex pattern="key" replace=""/>
                                <replaceregex pattern="${line.separator}"
e="" /><!-- newly added line to eliminate new line or CR -->
                                <replacestring from="=" to=""/>

However, after sending parameter to the ant task it fails. Then I discover
the value of temp.param contain the newline (or carriage return). The output
using '<echo message="[${temp.param}]"/>' is as follow:

     [echo] [value
     [echo] ]

The value I expect is [value] not [value\n]. 

I try to use '<replaceregex pattern="${line.separator}" replace="" />', but
it does not work at all.

What should I do in order to get rid of it.

View this message in context:
Sent from the Ant - Users mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message