summaryrefslogtreecommitdiff
path: root/t/re
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-01-19 20:29:42 -0700
committerKarl Williamson <public@khwilliamson.com>2013-01-19 21:04:27 -0700
commit4d68ffa0f7f345bc1ae6751744518ba4bc3859bd (patch)
treef26602b7dbb509fd5be0a7bf4b3f4e7f29f92a3b /t/re
parenta8d9c7ae5b2de9d5434563530be821c884d9a6a7 (diff)
downloadperl-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 't/re')
-rw-r--r--t/re/re_tests1
1 files changed, 1 insertions, 0 deletions
diff --git a/t/re/re_tests b/t/re/re_tests
index e2a7e890c4..c41d529f8f 100644
--- a/t/re/re_tests
+++ b/t/re/re_tests
@@ -1730,5 +1730,6 @@ ab[c\\\](??{"x"})]{3}d ab\\](d y - -
\Vn \xFFn/ y $& \xFFn
/(?l:a?\w)/ b y $& b
+m?^xy\?$? xy? y $& xy?
# vim: softtabstop=0 noexpandtab