diff options
author | Karl Williamson <public@khwilliamson.com> | 2013-01-19 20:29:42 -0700 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2013-01-19 21:04:27 -0700 |
commit | 4d68ffa0f7f345bc1ae6751744518ba4bc3859bd (patch) | |
tree | f26602b7dbb509fd5be0a7bf4b3f4e7f29f92a3b /handy.h | |
parent | a8d9c7ae5b2de9d5434563530be821c884d9a6a7 (diff) | |
download | perl-4d68ffa0f7f345bc1ae6751744518ba4bc3859bd.tar.gz |
Deprecate certain rare uses of backslashes within regexes
There are three pairs of characters that Perl recognizes as
metacharacters in regular expression patterns: {}, [], and (). These
can be used as well to delimit patterns, as in:
m{foo}
s(foo)(bar)
Since they are metacharacters, they have special meaning to regular
expression patterns, and it turns out that you can't turn off that
special meaning by the normal means of preceding them with a backslash,
if you use them, paired, within a pattern delimitted by them. For
example, in
m{foo\{1,3\}}
the backslashes do not change the behavior, and this matches "f", "o"
followed by one to three more occurrences of "o".
Usages like this, where they are interpreted as metacharacters, are
exceedingly rare; we think there are none, for example, in all of CPAN.
Hence, this deprecation should affect very little code. It does give
notice, however, that any such code needs to change, which will in turn
allow us to change the behavior in future Perl versions so that the
backslashes do have an effect, and without fear that we are silently
breaking any existing code.
=head1 Performance Enhancements
Diffstat (limited to 'handy.h')
-rw-r--r-- | handy.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -794,7 +794,8 @@ patched there. The file as of this writing is cpan/Devel-PPPort/parts/inc/misc # define _CC_QUOTEMETA 20 # define _CC_NON_FINAL_FOLD 21 # define _CC_IS_IN_SOME_FOLD 22 -/* Unused: 23-31 +# define _CC_BACKSLASH_FOO_LBRACE_IS_META 31 /* temp, see mk_PL_charclass.pl */ +/* Unused: 23-30 * If more bits are needed, one could add a second word for non-64bit * QUAD_IS_INT systems, using some #ifdefs to distinguish between having a 2nd * word or not. The IS_IN_SOME_FOLD bit is the most easily expendable, as it |