Thanks so much. It works. You are the man :)
Michael Ludwig-6 wrote:
>
> Andy2008 schrieb am 22.06.2010 um 17:17 (-0700):
>>
>> Here's my input
>>
>> abc/long/distance
>>
>> I want to get abc back. Here's my code
>>
>> <propertyregex property="myprop"
>> input="${input}"
>> regexp="(.*)/*"
>> select="\0"
>> casesensitive="false" />
>>
>> but I got back the whole string (abc/long/distance)
>>
>> Do you have any ideas?
>
> Yes. You appear to be using a mixture of regular expressions,
> as in "(.*)", and shell patterns, as in "/*". Your first group
> *greedily* (terminus technicus) captures the entire string until
> the end of the line. You'd probably benefit from reading up on
> Java regular expression syntax.
>
> <project>
> <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
> <property name="input" value="abc/long/distance"/>
> <echo message="${input}"/>
> <propertyregex property="myprop" input="${input}"
> regexp="([^/]+)" select="\0" casesensitive="false" />
> <echo message="${myprop}"/>
> </project>
>
> --
> Michael Ludwig
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
:clap::clap::clap::clap::clap::clap::clap::-D:-D
--
View this message in context:
http://old.nabble.com/propertyregex-question-tp28966275p28973797.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]