From: Rafael Garcia-Suarez Date: Fri, 2 Apr 2004 15:40:15 +0000 (+0000) Subject: Fix bug #27940 : \cX escapes weren't working correctly in regular X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b6d5fef8cdb4285e43c5a333b488b349d2c28bd9;p=p5sagit%2Fp5-mst-13.2.git Fix bug #27940 : \cX escapes weren't working correctly in regular expression ranges. p4raw-id: //depot/perl@22641 --- diff --git a/t/op/pat.t b/t/op/pat.t index 13dc180..9907149 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 e27e32c..e8c1073 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) {