You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Jacopo Cappellato <ja...@gmail.com> on 2009/02/04 12:00:19 UTC

replacing tokens in strings

Hi all,

I am trying to replace all occurrences of a given token in a file  
while copying it.
I am using the task:

<copy file="${build.dir}/version.txt" toFile="${dist.dir}/version.txt">
<filterset>
<filter token="DATE" value="${TODAY}"/>
</filterset>
</copy>

Everyting works fine if the token in the file are in the form of  
@DATE@ and are *separated* by other strings.
It doesn't work if the token is not separated by other strings, for  
example:
"@DATE@_suffix" is not replaced, while "today is @DATE@" it is.
Is there a workaround?
Thanks,
Jacopo


Re: replacing tokens in strings

Posted by Jacopo Cappellato <ja...@gmail.com>.
Please,

ignore my email... it actually works... it was another (not related)  
issue in my target.

Jacopo

On Feb 4, 2009, at 12:00 PM, Jacopo Cappellato wrote:

> Hi all,
>
> I am trying to replace all occurrences of a given token in a file  
> while copying it.
> I am using the task:
>
> <copy file="${build.dir}/version.txt" toFile="${dist.dir}/ 
> version.txt">
> <filterset>
> <filter token="DATE" value="${TODAY}"/>
> </filterset>
> </copy>
>
> Everyting works fine if the token in the file are in the form of  
> @DATE@ and are *separated* by other strings.
> It doesn't work if the token is not separated by other strings, for  
> example:
> "@DATE@_suffix" is not replaced, while "today is @DATE@" it is.
> Is there a workaround?
> Thanks,
> Jacopo
>