ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: AW: AW: Extracting key,value from a property
Date Tue, 06 Jul 2004 15:36:34 GMT
First time i had to do with regexp on unix (mmh awk or sed... long time
ago).
Then with perl - very intensive :)

Jan

> -----Ursprüngliche Nachricht-----
> Von: MCG QA [mailto:mcgqa@yahoo.com]
> Gesendet am: Dienstag, 6. Juli 2004 15:25
> An: Ant Users List
> Betreff: Re: AW: AW: Extracting key,value from a property
> 
> Hi Jan,
> 
> It does work, thanks,
> 
> This is my first experience with regexp, and as I
> mentioned before, I had hard time in understanding how
> regexp works. I followed an example from one website
> and did not (understand too much to) explore too much.
> 
> Thanks for showing me another way to do this with
> regexp. This tells me that I've a long way to go
> before I can say I'm comfortable with regexp.
> 
> Thanks
> Srikanth
> 
> --- Jan.Materne@rzf.fin-nrw.de wrote:
> > <propertyregex property="ejb.name"
> >    input="${cur-ejb-value-loc}"
> >    regexp="(.*)=(.*)"
> >    select="\1"
> >    casesensitive="false" />
> > <propertyregex property="ejb.value"
> >    input="${cur-ejb-value-loc}"
> >    regexp="(.*)=(.*)"
> >    select="\2"
> >    casesensitive="false" />
> > 
> > hadnt worked?
> > 
> > Jan
> > 
> > 
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: MCG QA [mailto:mcgqa@yahoo.com]
> > > Gesendet am: Dienstag, 6. Juli 2004 00:54
> > > An: Ant Users List
> > > Betreff: Re: AW: Extracting key,value from a
> > property
> > > 
> > > Thank Jan,
> > > 
> > > I wanted to acccess "AuthorAddressEntityBean" as
> > > ${key}. Had little hard time with
> > <propertyregexp>,
> > > esp. the parameter regexp, but ultimately I could
> > > split the ${key} and ${value}. Thanks for your
> > inputs.
> > > Here is what I did.
> > > 
> > > <target name="for-each-test"> 
> > > <loadfile property="ejb-value-loc"
> > > srcFile="c:/temp/envs.txt"/>
> > > <foreach list="${ejb-value-loc}"
> > delimiter="
> "
> > > param="cur-ejb-value-loc" target="loop-target">
> > > </foreach>
> > > </target> 
> > > 	
> > > <target name="loop-target">
> > >  <propertyregex property="ejb.name"
> > >     input="${cur-ejb-value-loc}"
> > >     regexp="([^@]*)"
> > >     select="\0"
> > >     casesensitive="false" />
> > >  
> > >  <propertyregex property="ejb.value"
> > >     input="${cur-ejb-value-loc}"
> > >     regexp="([^@.]*$)"
> > >     select="\0"
> > >     casesensitive="false" />
> > > <echo>Complete String :
> > ${cur-ejb-value-loc}</echo>
> > > <echo>ejb-name : ${ejb.name}</echo>		
> > > <echo>ejb-location : ${ejb.value}</echo>          
> >    
> > > </target>
> > > 
> > > 
> > > I modified the property file env.txt which
> > contains
> > > values as under:
> > > 
> > > AuthorAddressEntityBean@c:/temp
> > > 
> > > 
> > > ================================================
> > > --- Jan.Materne@rzf.fin-nrw.de wrote:
> > > > If you only want to have the properties loaded
> > > > simply use <property
> > > > file=""/>.
> > > > 
> > > > If you want to access the
> > "AuthorAddressEntityBean"
> > > > as ${key} simply split
> > > > the 
> > > > value.
> > > > - using AntContribs <propertyregexp>
> > > > - using <script> and java.lang.String.split()
> > > > 
> > > > Jan
> > > > 
> > > > > -----Ursprüngliche Nachricht-----
> > > > > Von: MCG QA [mailto:mcgqa@yahoo.com]
> > > > > Gesendet am: Freitag, 2. Juli 2004 23:49
> > > > > An: Ant Users List
> > > > > Betreff: Extracting key,value from a property
> > > > > 
> > > > > I have a property file env.txt which contains
> > > > values
> > > > > as under:
> > > > > 
> > > > > AuthorAddressEntityBean=c:/temp
> > > > > AuthorDetailsSessionBean=c:/bea
> > > > > AuthorEntityBean=c:/b-copy
> > > > > AuthorXrefEntityBean=c:/WEB-INF
> > > > > BindingXref=c:/PVCS
> > > > > BiographiesSessionBean=c:/mhhe-build
> > > > > CommonSessionBean=c:/qalogs
> > > > > CompetCategorySessionBean=c:/qalogs/mhhe
> > > > > 
> > > > > I'm using <foreach> task and set it as a
> > property 
> > > > as
> > > > > under:
> > > > > 
> > > > > <foreach list="${environments}" delimiter="
> > > "
> > > > > param="CurEnv" target="loop-target"/>
> > > > > 
> > > > > 
> > > > > And when I execute this task, which is
> > basically
> > > > an
> > > > > echo at this moment, I would get the following
> > > > values
> > > > > for Curenv for each iteration/line:
> > > > > Curenv:AuthorAddressEntityBean=c:/temp
> > > > > Curenv:AuthorDetailsSessionBean=c:/bea
> > > > > Curenv:AuthorEntityBean=c:/b-copy
> > > > > etc...
> > > > > 
> > > > > What I would like to do is to extract each of
> > the
> > > > > above as both key and value, into two separate
> > > > > variables.
> > > > > 
> > > > > for example, my <foreach> task would return me
> > a
> > > > > property "AuthorAddressEntityBean=c:/temp"
> > > > > 
> > > > > I would like to extract from this property the
> > > > > following: 
> > > > > "key" = AuthorAddressEntityBean
> > > > > "value" = c:/temp 
> > > > > in this case.
> > > > > 
> > > > > How can I do this?
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail is new and improved - Check it out!
> http://promotions.yahoo.com/new_mail
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

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