FAIL("trailing \\ in regexp");
/* FALL THROUGH */
default:
- if (!SIZE_ONLY && ckWARN(WARN_REGEXP) && isALPHA(*p))
+ if (!SIZE_ONLY && ckWARN(WARN_REGEXP) &&
+ isALPHA(*p) && *p != '_')
Perl_warner(aTHX_ WARN_REGEXP,
"/%.127s/: Unrecognized escape \\%c passed through",
PL_regprecomp,
PL_regcomp_parse += numlen;
break;
default:
- if (!SIZE_ONLY && ckWARN(WARN_REGEXP) && isALPHA(value))
+ if (!SIZE_ONLY && ckWARN(WARN_REGEXP) &&
+ isALPHA(value) && value != (UV)'_')
Perl_warner(aTHX_ WARN_REGEXP,
"/%.127s/: Unrecognized escape \\%c in character class passed through",
PL_regprecomp,
PL_regcomp_parse += numlen;
break;
default:
- if (!SIZE_ONLY && ckWARN(WARN_REGEXP) && isALPHA(value))
+ if (!SIZE_ONLY && ckWARN(WARN_REGEXP) &&
+ isALPHA(value) && value != (U32)'_')
Perl_warner(aTHX_ WARN_REGEXP,
"/%.127s/: Unrecognized escape \\%c in character class passed through",
PL_regprecomp,
########
# regcomp.c [S_regatom]
$x = '\m' ;
+$y = '\_' ;
use warnings 'regexp' ;
$a =~ /a$x/ ;
+$b =~ /b$y/ ;
no warnings 'regexp' ;
$a =~ /a$x/ ;
+$b =~ /b$y/ ;
EXPECT
/a\m/: Unrecognized escape \m passed through at - line 4.
########
# regcomp.c [S_regclass S_regclassutf8]
use warnings 'regexp' ;
$a =~ /[a\zb]/ ;
+$b =~ /[a\_b]/ ;
no warnings 'regexp' ;
$a =~ /[a\zb]/ ;
+$b =~ /[a\_b]/ ;
EXPECT
/[a\zb]/: Unrecognized escape \z in character class passed through at - line 3.
default:
{
dTHR;
- if (ckWARN(WARN_MISC) && isALNUM(*s))
+ if (ckWARN(WARN_MISC) && isALNUM(*s) && *s != '_')
Perl_warner(aTHX_ WARN_MISC,
"Unrecognized escape \\%c passed through",
*s);