ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey E Care <>
Subject Re: splitting a string
Date Tue, 11 Oct 2005 00:09:18 GMT
I think AntContrib's <propertyregex> task could do this.

Jeffrey E. Care (
WebSphere v7 Release Engineer
WebSphere Build Tooling Lead (Project Mantis)

"Lasher, James L" <> 
10/10/2005 07:43 PM
Please respond to
"Ant Users List"

"Ant Users List" <>

splitting a string

Hello all,

I'm hoping someone here could help me with an idea on how to take a
property and "split" it into two (additional) properties.  My specific
situation is that I have a property that has a value of
[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9].  I would like to split this so
that I end up with one new property whose value is the beginning of the
original property string ([0-9][0-9].[0-9][0-9]) and the second whose
value would be the last set of [0-9][0-9][0-9]. 

I currently have the original property defined in a file
(/tmp/refverprops) which looks like:


I've figured out a way to get the second property value which in my
example will be ReferenceVersionMinor by doing the following:

       <loadproperties srcfile="/tmp/refverprops">
           <contains value="ReferenceVersionMinor"/>
           <replaceregex pattern="[0-9][0-9]\.[0-9][0-9]\." replace=""/>

This will give me a property name/value of ReferenceVersionMinor/555
I can't figure out though how to do something similar to get the first
property value of:  02.10 (without a trailing dot after 10).  I could
whip up a custom task to do this for me, but would prefer to use what's
already available in Ant, if I can find what that might be.  Can anyone


To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message