On Mon, 15 May 2006 [EMAIL PROTECTED] wrote:

> David B Funk wrote:
> > what is the meaning of ".{,50}?"
>
> a{m,n} matches any string of at least m and at most n copies of "a".
> a{m} is a shortcut for a{m,m}
> a{m,} has no upper bound on the length
> a{,n} is a typo, sorry.  Should be a{0,n}.
> a+ is a shortcut for a{1,}
> a* is a shortcut for a{0,}
>
> All of these are greedy by default.  Putting the ? after them means they 
> match the shortest possible string, rather than the longest.
>
> So .{0,50} means "zero to fifty characters of any kind"

I know all that stuff, but what I'm saying is ".{0,50}?"
(IE non-greedy) will always match the null string, unless there's
something -AFTER- it to force a match on a larger than null string.
As he's specified the '(?>' (non-backtracking grouping) and there's
no explicit string following that particular match, what's to keep
it from stoping prematurly and thus not working at all?

Thus my suggested alternative to give it something to chew on
('[^>]{0,50}') rather than the '.{0,50}' to provide an explicit
termination criteria.


-- 
Dave Funk                                  University of Iowa
<dbfunk (at) engineering.uiowa.edu>        College of Engineering
319/335-5751   FAX: 319/384-0549           1256 Seamans Center
Sys_admin/Postmaster/cell_admin            Iowa City, IA 52242-1527
#include <std_disclaimer.h>
Better is not better, 'standard' is better. B{

Reply via email to