You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Bin Chen <bi...@bea.com> on 2003/01/14 22:53:42 UTC

How to use regexp replace task with ant 1.5

Hi, I am trying to use the replaceregexp task of ant 1.5 to match and
replace certain patterns, here is the sample:
<replaceregexp
    file="${Dest}/sample.cmd">
           <regexp pattern=":_sample_command_marker"/>
               <substitution expression="@rem my substitution \n set
CMD_HOME=@MY_HOME\mysample"/>
</replaceregexp>
Here "\n" is supposed to be a newline, and "\" in CMD_HOME is supposed to be
a direcory
However, when the substitution occured, all back slashes were taken out,
even when I tried using "\\n" and "\\", they were still taken out. Any idea
what happend there?
BTW, I am using jdk1.4.1_01 and jakarta ORO and jakarta regexp as
recommended by the ant document.

Your help is greatly appreciated.

Bin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>