ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Fix <jakob....@gmail.com>
Subject Re: backslash escaping in a regex
Date Tue, 11 May 2010 17:11:44 GMT
Hi Stefan,

eight backslashes, wow! That means four intermediate steps to get from

\\\\\\\\ to \

I'll probably just go with the forward slashes in the property file
and pathconvert them to backslashes.

thanks a lot,
Jakob.



On Tue, May 11, 2010 at 17:29, Stefan Bodewig <bodewig@apache.org> wrote:
> 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
>
>

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


Mime
View raw message