develooper Front page | perl.perl5.porters | Postings from September 2016

Re: [perl #129277] [PATCH] addition to perlrecharclass about '$' as"special"

Thread Previous | Thread Next
September 15, 2016 23:13
Re: [perl #129277] [PATCH] addition to perlrecharclass about '$' as"special"
Message ID:
On Thu, Sep 15, 2016 at 11:34:02AM -0700, Kevin Goess wrote:
> # New Ticket Created by  Kevin Goess 
> # Please include the string:  [perl #129277]
> # in the subject line of all future correspondence about this issue. 
> # <URL: >
> This is a bug report for perl from,
> generated with the help of perlbug 1.40 running under perl 5.25.5.
> -----------------------------------------------------------------
> [Please describe your issue here]
> I'm suggesting a documentation change. perlrecharclass says "Most characters
> that are meta characters in regular expressions...lose their special meaning
> and can be used inside a character class without the need to escape them" and
> goes on to list the ones that do need to be escaped. It does *not* list a '$'.
> But this will not match a dollar sign or a comma:
>   [$,]

But it does:

    $ perl -wE 'say q{$} =~ q{[$,]}'

> and it would be good advice to point out that a '$' is as special inside a
> character class as it is anywhere else in a regular expression.

Now, if you use delimiters which allow for interpolation of variables,
said interpolation will happen -- but it will happen before perl even
knows there is a character class.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About