This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Warn on unescaped /[]}]/ under re strict
authorKarl Williamson <khw@cpan.org>
Fri, 6 Jan 2017 05:03:35 +0000 (22:03 -0700)
committerKarl Williamson <khw@cpan.org>
Fri, 13 Jan 2017 19:20:04 +0000 (12:20 -0700)
commita4368cc338f9178e7f4861a61ab56710050e50dc
tree9eb8165e2f994d49db0aa9b569755940914ade22
parentb1793c1ad815aa7190b1daead0f0d4fce340aff6
Warn on unescaped /[]}]/ under re strict

This commit generates a warning when the experimental 're strict'
feature is in effect for unescaped '}' and ']' characters (in a regular
expression pattern) that are interpreted literally.

This brings the behavior of these more in line with ')' which croaks
when it is taken literally.

The problem with the existing behavior is that these characters may be
metacharacters or they may be literals, depending on action at a
distance.  Not so with ')', which is always a metacharacter unless
escaped.

Ideally, all three of these characters should behave similarly, but it
really is too late for that, except we can warn if the user has
requested extra checking of their patterns with this experimental
're strict' feature.
pod/perldelta.pod
pod/perldiag.pod
regcomp.c
t/re/reg_mesg.t