ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <>
Subject replaceregex, only the first match
Date Thu, 12 Jan 2006 11:17:43 GMT


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

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 


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


doesn't work as i expected. i thought, when using byline="false" only
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
    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:
For additional commands, e-mail:

View raw message