summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-04-02 15:40:15 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-04-02 15:40:15 +0000
commitb6d5fef8cdb4285e43c5a333b488b349d2c28bd9 (patch)
treea3b43c76a939abb4259c146984ae5f1ab41ba79e
parent88be34b600bd4d61923762dd138558270cb4d3f1 (diff)
downloadperl-b6d5fef8cdb4285e43c5a333b488b349d2c28bd9.tar.gz
Fix bug #27940 : \cX escapes weren't working correctly in regular
expression ranges. p4raw-id: //depot/perl@22641
-rwxr-xr-xt/op/pat.t12
-rw-r--r--toke.c2
2 files changed, 11 insertions, 3 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index 13dc180c76..9907149b83 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -6,7 +6,7 @@
$| = 1;
-print "1..1056\n";
+print "1..1063\n";
BEGIN {
chdir 't' if -d 't';
@@ -3269,5 +3269,13 @@ ok("a-bc" eq eval {
"$x-$y";
}, 'captures can move backwards in string');
-# last test 1056
+# perl #27940: \cA not recognized in character classes
+ok("a\cAb" =~ /\cA/, '\cA in pattern');
+ok("a\cAb" =~ /[\cA]/, '\cA in character class');
+ok("a\cAb" =~ /[\cA-\cB]/, '\cA in character class range');
+ok("abc" =~ /[^\cA-\cB]/, '\cA in negated character class range');
+ok("a\cBb" =~ /[\cA-\cC]/, '\cB in character class range');
+ok("a\cCbc" =~ /[^\cA-\cB]/, '\cC in negated character class range');
+ok("a\cAb" =~ /(??{"\cA"})/, '\cA in ??{} pattern');
+# last test 1063
diff --git a/toke.c b/toke.c
index e27e32cc6e..e8c1073d24 100644
--- a/toke.c
+++ b/toke.c
@@ -1220,7 +1220,7 @@ S_scan_const(pTHX_ char *start)
const char *leaveit = /* set of acceptably-backslashed characters */
PL_lex_inpat
- ? "\\.^$@AGZdDwWsSbBpPXC+*?|()-nrtfeaxcz0123456789[{]} \t\n\r\f\v#"
+ ? "\\.^$@AGZdDwWsSbBpPXC+*?|()-nrtfeaxz0123456789[{]} \t\n\r\f\v#"
: "";
if (PL_lex_inwhat == OP_TRANS && PL_sublex_info.sub_op) {