On Fri, Oct 10, 2003 at 04:56:56PM -0400, Larry Gilson wrote:
> As an > example, an exact count would be matched if I omit the comma.
> /\w{5}/ will match exactly five word characters.
Definitely yes.

> Now if I modify that as /\w{5}?/, I believe that means zero or
> one occurance of five word characters just as /\w{5}+/ should
> mean one or more five word characters.  I don't really know if
> this works or not but I believe this is correct.
Sorry, not in my 'man perlre'.

The difference between a pattern
   (something){quantified}
and with '?' as
   (something){quantified}?
is that the '?' says
   'make it the shortest match' ('nongreedy')!
while without it the normal way is the longest match.

There are two 'degenerate' cases:

One is the above 'exact N characters' where the '?' seems to
be useless (the longest or shortest exact N characters :-),
and the other ist the well known '(something)?' which would
be completely useless if not made greedy :-)

But '(something){quantification}?' may have been created
by combining strings and so the '?' is allowed on 'exact'
counts I assume.

Well, this all was in my 'man perlre' and hopefully did
NOT change with the last upgrade from perl5.6 to 5.8?

If it changed please somebody warn me ASAP :-)

Stucki   (postmaster at math.fu-berlin.de)



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to