develooper Front page | perl.perl5.porters | Postings from October 2014

Re: Expected behavior of \Q inside a bracketed character class?

Thread Previous | Thread Next
From:
Marco Moreno
Date:
October 17, 2014 20:35
Subject:
Re: Expected behavior of \Q inside a bracketed character class?
Message ID:
483D14A1-9A95-420D-AF8D-06028D75A299@pobox.com

> On Oct 17, 2014, at 7:05 AM, Dave Mitchell <davem@iabyn.com> wrote:
> 
> You talk about "\Q inside a bracketed character class" but your example
> above is actually a bracketed character class inside a \Q. Which one are
> you concerned about?

Yes, I copy/pasted the wrong regex as I mentioned in my followup post.

> So I think the docs are wrong. For example, the following:
> 
>    $r = qr/[a\Q]b\E]/;
>    print $r,"\n";
> 
> outputs
> 
>    ...[a\]b]...
> 
> at least as far back as 5.6.1

See Erik’s & Eirik’s responses for an explanation of how the docs are confusing and misleading, yet correct.

Marco


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