develooper Front page | perl.perl5.porters | Postings from February 2015

Re: [perl #123820] documentation error in perlrecharclass

Thread Previous | Thread Next
From:
demerphq
Date:
February 15, 2015 04:12
Subject:
Re: [perl #123820] documentation error in perlrecharclass
Message ID:
CANgJU+UjdeRT1+kwnf0hKU7mTtkrfiy81nYCnwo60wJVHnzF+A@mail.gmail.com
On 14 February 2015 at 18:40,  <saint.snit@gmail.com> wrote:
>> > #####
>> > "[]"  =~ /[[]]/      #  Match, the pattern contains a character class
>> >                      #  containing just ], and the character class is
>> >                      #  followed by a ].
>> > #####
>>
>> that does not rule out that this is a subtle regression
>> and that older perls did actually parse as documented.
>
> It is hard to conceive how that commentary could describe that regular expression for any version of perl.

I agree. But, well, in the regex engine I never rule anything out. :-p

> Consider its components:
>
>  - a character class (which must be terminated by a right bracket)
>  - containing ]
>  - followed by ]
>
> So three right brackets are required to encompass all three of those components.
>
> On the other hand, changing the text from "containing just ]" to "containing just [" makes it describe the regular expression perfectly.

Indeed.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About