[tpm] Greedy regex question

Madison Kelly linux at alteeve.com
Fri Feb 29 08:40:35 PST 2008

Jim Graham wrote:
> Hi
>   It's not really greedy, per-se. It's what you are asking for. Find the 
> first "(" followed by any character(s), followed by a ")" at the end of 
> the string. Greedy/non-greedy means, basically, given a starting point, 
> go as far as you can (greedy) or go as short as you can (non-greedy). By 
> forcing the last ")" to be at the end of the string, they become the 
> same thing. Note non-greedy doesn't mean find the shortest possible 
> match (which is what you want).
>   I will try to come up with a solution you want.
>   - jim

Grah, of course you are right... I think I was looking too closely at 
the (...) part. =/ My problem is that I am not able to know if a given 
string will have zero or more '(...)' components to it. Thanks for your 
help... if you do come up with a solution, I will be very greatful!


More information about the toronto-pm mailing list