Robert Dober
5/6/2009 7:31:00 AM
On Wed, May 6, 2009 at 9:18 AM, Sriram Varahan <sriram.varahan@gmail.com> w=
rote:
> Hello,
>
>
> =A0I have this string:
>
> =A0 =A0"d:\\home\\abc2.zip\\abc.zip\\abc.com"
>
> =A0I need to extract the contents up to the first occurrence of zip which
> would be:
>
> =A0"d:\\home\\abc2.zip"
>
> When i use a regex like: \(.+).zip\ it gives me the entire contents upto
> the second zip.
Why are you so greedy Sriram ;)? Well it is not you it is the "+"
which is greedy, try the non greedy version "+?" it might just give
you a nice surprise.
R.