Re: Question about perlreref - are {n} and {n}? different?
- From: "Dr.Ruud" <rvtol+news@xxxxxxxxxxxx>
- Date: Sat, 29 Oct 2005 15:06:43 +0200
Juha Laiho schreef:
> Dr.Ruud:
>>> perlreref::QUANTIFIERS says:
>>>
>>> Quantifiers are greedy by default -- match the longest leftmost.
>>> Maximal Minimal Allowed range
>>> ------- ------- -------------
>>> {n,m} {n,m}? Must occur at least n times but no more than m
>>> times
>>
>> The 'Must occur ... no more than m times' is not accurate.
>
> Hmm.. given a little bit more context, it is accurate:
>
> AX{n,m}B
Yes, but not in general.
echo 'AXXXXXXXXB' |
perl -ne 'chomp; print "$_:OK\n" if /AX{2,3}/;'
Compare perlre(1)
{n} Match exactly n times
{n,} Match at least n times
{n,m} Match at least n but not more than m times
Compare grep(1)
{n} The preceding item is matched exactly n times.
{n,} The preceding item is matched n or more times.
{n,m} The preceding item is matched at least n times,
but not more than m times.
So perlreref(1) could use one of those.
--
Affijn, Ruud
"Gewoon is een tijger."
.
- References:
- Question about perlreref - are {n} and {n}? different?
- From: usenet
- Re: Question about perlreref - are {n} and {n}? different?
- From: Dr.Ruud
- Re: Question about perlreref - are {n} and {n}? different?
- From: Juha Laiho
- Question about perlreref - are {n} and {n}? different?
- Prev by Date: Re: Typing tutor help script needed, please
- Next by Date: Re: Typing tutor help script needed, please
- Previous by thread: Re: Question about perlreref - are {n} and {n}? different?
- Next by thread: Re: Question about perlreref - are {n} and {n}? different?
- Index(es):