ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: backslash escaping in a regex
Date Tue, 11 May 2010 15:29:23 GMT
On 2010-05-11, Jakob Fix <jakob.fix@gmail.com> 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.

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message