|
Hello all,
I want to attain the following String manipulation: 200802 2008/02 ich wrote the followinfg code bat is not working. Can somebody help me. Thanks <propertyregex property="adjustedDate" input="${date}" // 200802 regexp="([0-9]{5})([0-9]{2})" replace="\1/\2"/> <echo message="Date: ${adjustedDate}"/> ${adjustedDate} why Thanks _________________________________________________________________ Appelez vos amis de PC à PC -- C'EST GRATUIT http://get.live.com/messenger/overview |
|
regexp="([0-9]{5})([0-9]{2})" replace="\1/\2"
The first group has 4 not 5 characters. Jan -----Ursprüngliche Nachricht----- Von: Yannick Feuzet [mailto:[hidden email]] Gesendet: Dienstag, 2. September 2008 14:38 An: [hidden email] Betreff: propertyregex Hello all, I want to attain the following String manipulation: 200802 2008/02 ich wrote the followinfg code bat is not working. Can somebody help me. Thanks <propertyregex property="adjustedDate" input="${date}" // 200802 regexp="([0-9]{5})([0-9]{2})" replace="\1/\2"/> <echo message="Date: ${adjustedDate}"/> ${adjustedDate} why Thanks _________________________________________________________________ Appelez vos amis de PC à PC -- C'EST GRATUIT http://get.live.com/messenger/overview --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by Yannick Feuzet
On Tue, 2 Sep 2008, Yannick Feuzet <[hidden email]> wrote:
> I want to attain the following String manipulation: > > 200802 2008/02 > > ich wrote the followinfg code bat is not working. Can somebody help > me. Thanks > > <propertyregex property="adjustedDate" > input="${date}" // 200802 > regexp="([0-9]{5})([0-9]{2})" > replace="\1/\2"/> First of all, you realize that propertyregexp is not a task provided by Ant but the ant-contrib project which is separate and provides a user forum of itself, do you? I think the first group of your regexp is meant to contain {4}, not {5}. Stefan --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
In reply to this post by Yannick Feuzet
Hi, as Jan and Stefan already stated the {5} in the first goup is wrong. Notice you may write \d instead of [0-9], so = <propertyregex property="adjustedDate" input="${date}" regexp="(\d{4})(\d{2})" replace="\1/\2"/> will do the job. btw. if the ${date} comes from a tstamp task, you don't need the propertyregex stuff at all, f.e. = <tstamp> <format property="date" pattern="yyyy/MM"/> </tstamp> will give you = [echo] ${date} == 2008/09 Regards, Gilbert --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
| Powered by Nabble | Edit this page |
