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

Re: [perl #123820] documentation error in perlrecharclass

Thread Next
From:
saint.snit
Date:
February 14, 2015 18:39
Subject:
Re: [perl #123820] documentation error in perlrecharclass
Message ID:
54df2619.07af3c0a.08d4.38c4@mx.google.com
> > #####
> > "[]"  =~ /[[]]/      #  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.  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.

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