ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alain ROY <armaill...@free.com>
Subject Re: Capitalize property value
Date Thu, 31 Jan 2008 14:08:13 GMT

Thanks for the link. 
There's an example to capitalize all words with more than 2 characters.
Search string is : "\\w{2,}"
Replace string is : "\\L\\u$&"

I tried :

      <property name="src" value="a foo and a BAR" />
      <property name="s1" value="\\w{2,}" />
      <property name="s2" value="\\L\\u$&amp;" />

      <propertyregex property="dst"
                     input="${src}"
                     regexp="${s1}"
                     replace="${s2}"
                     global="true"
      />
      <echo message="${src}  -->  ${dst}" />

1) With : 
      <property name="s1" value="\\w{2,}" />
      <property name="s2" value="\\L\\u$&amp;" />
   I get :
      a foo and a BAR  -->  ${dst}

2) With : 
      <property name="s1" value="\w{2,}" />
      <property name="s2" value="\\L\\u$&amp;" />
   I get :
       a Lu$& Lu$& a Lu$&

3) I tried with : 
      <property name="s2" value="\L\u$&amp;" />
      or
      <property name="s2" value="\\\L\\\u$&amp;" />
      or
      <property name="s2" value="\\\\L\\\\u$&amp;" />

   Nothing works.

Any idea ?

On Thu, 31 Jan 2008 12:18:20 +0000
Robin Chaddock <robin.chaddock@iplay.com> wrote:

> Java's regex replace supports case conversion -> 
> http://www.javaregex.com/tutorial5.html
> 
> So you should be able to do it through the propertyregexp task.
> 
> 
> Alain ROY wrote:
> > Hi all
> >
> > I need to capitalize a property value. I tried using regular expressions and the
Antcontrib propertyregexp task, but it doesn't work. I don't know how to specifiy the uppercase
value of the matched string in the replacement string. 
> > Is there a way to do so without developping a filter java class ?
> >
> > Regards
> >
> >   
> 
> 
> ________________________________________________________________________
> E-mail is an informal method of communication and may be subject to data corruption,
interception and unauthorised amendment for which I-play, a trading name of Digital Bridges
Ltd will accept no liability. Therefore, it will normally be inappropriate to rely on information
contained on e-mail without obtaining written confirmation.
> 
> This e-mail may contain confidential and/or privileged information. If you are not the
intended recipient (or have received this e-mail in error) please notify the sender immediately
and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material
in this e-mail is strictly forbidden.
> 
> (C) 2005. I-play is a trademark and trading name of Digital Bridges Limited. All Rights
Reserved.
> ________________________________________________________________________
> This message has been checked for all known viruses by the 
> MessageLabs Virus Scanning Service. For further information visit
> http://www.messagelabs.com/stats.asp
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 


-- 
Alain ROY <armaillist@free.com>

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


Mime
View raw message