diff --git a/regexec.c b/regexec.c index f291be0ad90d..4ed2ba9d42b2 100644 --- a/regexec.c +++ b/regexec.c @@ -804,12 +804,15 @@ Perl_re_intuit_start(pTHX_ " Looking for check substr at fixed offset %"IVdf"...\n", (IV)prog->check_offset_min)); - if (SvTAIL(check) && !multiline) { - /* In this case, the regex is anchored at the end too, - * so the lengths must match exactly, give or take a \n. - * NB: slen >= 1 since the last char of check is \n */ - if ( strend - s > slen || strend - s < slen - 1 - || (strend - s == slen && strend[-1] != '\n')) + if (SvTAIL(check)) { + /* In this case, the regex is anchored at the end too. + * Unless it's a multiline match, the lengths must match + * exactly, give or take a \n. NB: slen >= 1 since + * the last char of check is \n */ + if (!multiline + && ( strend - s > slen + || strend - s < slen - 1 + || (strend - s == slen && strend[-1] != '\n'))) { DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, " String too long...\n")); diff --git a/t/re/re_tests b/t/re/re_tests index 7ab7dc34fcca..a36a3e02488b 100644 --- a/t/re/re_tests +++ b/t/re/re_tests @@ -1883,6 +1883,7 @@ A+(*PRUNE)BC(?{}) AAABC y $& AAABC \d<(.*?)> a<> n - - [bcd].{2,3}aaaa XbXaaaaa y - - [bcd].{2,3}aaaa Xb\x{100}aaaaa y - - +'\Awibble\z'm wibble y - - # Keep these lines at the end of the file # vim: softtabstop=0 noexpandtab