ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Harkness, David" <DHarkn...@sonypictures.com>
Subject RE: Regular Expression Pattern
Date Fri, 05 Sep 2003 22:16:46 GMT
Vikas Phonsa <mailto:VPhonsa@suz.com> once said:
> Another question. I don't know anything abt regular expressions. I
> have a property <property name="project.name" value="SCA_COMMON"/> 
> 
> I need to set another property named "manifest.file" with
> value="COMMON.MF". 
> 
> I need to somehow extract the string "COMMON" from the project.name
> and add ".MF" to it. 
> 
> ----------------------------------------------------------------
> 	<property name="project.name" value="SCA_COMMON"/>
> 
> 	<propertyregex property="manifest.name"
>               input="${project.name}"
>               regexp="[^\.]*\.[^\.]*\.[^\.]*\."
>               replace="\2"
>               casesensitive="false" />
> 
>    <echo message="Here is the new property=${manifest.name}"/>
> --------------------------------------------------------------------

I haven't used propertyregex before, but assuming it uses fairly
standard regexps the following should do the trick:

  <propertyregex property="manifest.name"
    input="${project.name}"
    regexp="[^_]*_(.*)"
    replace="\1.MF"
    casesensitive="false" />

David Harkness
Sr. Software Engineer
Sony Pictures Digital Networks
(310) 482-4756

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message