Hi,

Oops, of course, missed that , thanks !!

I've used that before, but didn't remember ;-)

btw, there are some gotchas i regularly run in,

i.e. when using

<equals arg1="${foo}" arg2="bla"/>

you have to use the syntax ${}

but when using 

<isset property="foo"/>

you have to write it without ${}


Regards, Gilbert
 

-----Original Message-----
From: Andrew Goktepe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 12, 2006 3:08 PM
To: Ant Users List
Subject: Re: replaceregex, only the first match

Remove the <tokenfilter> tags, and then your script will only replace
the
first occurrence.

<copy file="C:/test/props.xml" tofile="C:test/propss.xml">
       <filterchain>
       <replaceregex byline="false" pattern="&lt;vers.modul\..+"
replace=""/>
       <replaceregex byline="false" pattern="&lt;vers.module.+"
replace=""/>
       </filterchain>
</copy>

-Andrew

On 1/12/06, Rebhan, Gilbert <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
>
> i have problem with replaceregex.
>
> my script uses a xmlpropertyfile which is generated by
> another process.Sometimes there are doubled propertynames
> in that file
>
> i have to =
> 1. load the xmlpropertyfile, check for doubled properties
> 2. if doubled properties are found, i have to delete the first
>   occurence in the propertyfile
> 3. then unset the loaded properties and load the cleaned
>    xmlpropertyfile
>
> so i tried it that way =
>
> 1. loading the propertyfile, then using grep task from Antelope
>   with a regex to check whether the propertyname in doubt occurs
>   two times >>> works fine
>
> 2. with if isset property=set via grep task
>
> then
>
> <copy file="C:/test/props.xml" tofile="C:test/propss.xml">
>        <filterchain>
>        <tokenfilter>
>        <replaceregex byline="false" pattern="&lt;vers.modul\..+"
> replace=""/>
>        <replaceregex byline="false" pattern="&lt;vers.module.+"
> replace=""/>
>        <tokenfilter>
>        </filterchain>
>
> </copy>
>
> doesn't work as i expected. i thought, when using byline="false" only
> the
> first match of my regex is replaced, but all occurences are replaced.
> i tried also several flags with the same result.
>
> 3. then unset all properties of the original xmlproperty via unset
task
>    from Antelope, move the cleaned up xmlproperty to the original
>    file name, as this name is referenced in several other following
> scripts
>    and load it again
>
> Questions =
>
> - how to replace only the first match via replaceregex ?
> - are there any other ways with ant ?
>
> Any hints ?
>
> Regards, Gilbert
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to