ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: backslash escaping in a regex
Date Tue, 11 May 2010 15:29:23 GMT
On 2010-05-11, Jakob Fix <> wrote:

> Hi, looked through the archive, but I don't think pathconvert can be
> used in this case.

> property file:
> prop=E:\\foo\\bar

property files and backslahes are a pain.

> build file:
> <replaceregexp file="${target.dir}/foobar.xml">
>   <regexp pattern="value=&quot;[^&quot;]+&quot;"/>
>   <substitution expression="value=&quot;${prop}&quot;"/>
> </replaceregexp>

> I also tried double escaping i.e.
> prop=E:\\\\foo\\\\bar

> but there all backslashes disappear as well.

I'm afraid you'd need eight of them.  It may be simpler to use forward
slashes in your property file and <pathconvert> to translate them after
you've applied the regex.


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

View raw message