develooper Front page | perl.perl5.porters | Postings from December 2011

Re: [perl #107262] Unmatched \Q \E in regexp should warn

Thread Previous | Thread Next
From:
demerphq
Date:
December 29, 2011 03:08
Subject:
Re: [perl #107262] Unmatched \Q \E in regexp should warn
Message ID:
CANgJU+UxLK=1GXhWzURvYa4YAm=4=Zx+WcPdo7QaCoq3A1ae6Q@mail.gmail.com
On 29 December 2011 11:48, Ed Avis <perlbug-followup@perl.org> wrote:
> I expected a warning from these because \Q and \E are not matched:
>
> % perl -wE '$_ = "a"; /\Qa/ or die'
> % perl -wE '$_ = "a"; /a\E/ or die'
>
> I suggest that at the end of the regexp, if a \Q is still open then
> warn.
> If \E is found but there was no active \Q \l \u \L \U then warn.
> Maybe there shouldn't be a warning for unclosed \l and so on, since
> that is not a quoting mechanism in the same way as \Q...\E.


This construct is not regexp specific, and does not warn in other situations.

perl -le'my $x="\Qfoo[]"; print $x'
foo\[\]

IMO, not-a-bug.

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