From: Harlan Messinger on
Jeff Johnson wrote:
> "Harlan Messinger" <hmessinger.removethis(a)comcast.net> wrote in message
> news:85l2goFg86U1(a)mid.individual.net...
>
>>>> I meam what is the purpose of using a max of 3 here then ?
>>> In your example it doesn't serve any purpose. It serves a purpose if it's
>>> followed by something. If your pattern had been "o{1,3}d", then it would
>>> match "fod", "food", and "foood" but not "fooooooood".
>>>
>> Forget what I just said. It wouldn't make any difference there either. For
>> the maximum value to make a difference, there has to be something else
>> both before AND after the quantified item in the pattern. Pretend I'd
>> written "fo{1,3}d".
>
> It does make a difference, and in certain circumstances (no examples come
> immediately to mind) you might want it: This pattern creates multiple
> matches with each match being at most three o's.
>
>
Ah, you're right, in the context of a scan for *all* matching
substrings. I was thinking from the perspective of testing whether the
string has *a* matching substring.
From: Jeff Johnson on
"Harlan Messinger" <hmessinger.removethis(a)comcast.net> wrote in message
news:85ldh0FkllU1(a)mid.individual.net...

>>>>> I meam what is the purpose of using a max of 3 here then ?
>>>> In your example it doesn't serve any purpose. It serves a purpose if
>>>> it's followed by something. If your pattern had been "o{1,3}d", then it
>>>> would match "fod", "food", and "foood" but not "fooooooood".
>>>>
>>> Forget what I just said. It wouldn't make any difference there either.
>>> For the maximum value to make a difference, there has to be something
>>> else both before AND after the quantified item in the pattern. Pretend
>>> I'd written "fo{1,3}d".
>>
>> It does make a difference, and in certain circumstances (no examples come
>> immediately to mind) you might want it: This pattern creates multiple
>> matches with each match being at most three o's.
> Ah, you're right, in the context of a scan for *all* matching substrings.
> I was thinking from the perspective of testing whether the string has *a*
> matching substring.

And in that context you are absolutely right.