New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
regex /.*\z/ doesn't matches strings ending with \n #8905
Comments
From @moritzCreated by moritz@faui2k3.orgThis is a bug report for perl from moritz@faui2k3.org, ----------------------------------------------------------------- This topic was discussed on permonks: http://www.perlmonks.org/?node_id=616538 Perl Info
|
From schubiger@gmail.comOn Mon, May 21, 2007 at 06:50:15AM -0700, moritz@faui2k3.org (via RT) wrote:
I can reproduce it with bleadperl #31251 (but I'm not sure 6580 case '.': |
The RT System itself - Status changed from 'new' to 'open' |
From @demerphqOn 5/21/07, Steven Schubiger <schubiger@gmail.com> wrote:
nah, this is just the code for parsing the . (dot) construct. the cheers. -- |
From @demerphqOn 5/21/07, via RT moritz @ faui2k3. org <perlbug-followup@perl.org> wrote:
Attached patch fixes this case, and also possibly as a sideffect Once applied I believe that this bug can be closed. Gotta say tho, the optimiser is a scary place. cheers, -- |
From @demerphqfix_z.patchIndex: D:/dev/perl/ver/zoro/regcomp.c
===================================================================
--- D:/dev/perl/ver/zoro/regcomp.c (revision 1874)
+++ D:/dev/perl/ver/zoro/regcomp.c (revision 1875)
@@ -4121,7 +4121,6 @@
char* exp = SvPV((SV*)pattern, plen);
char* xend = exp + plen;
regnode *scan;
- regnode *first;
I32 flags;
I32 minlen = 0;
I32 sawplus = 0;
@@ -4145,7 +4144,7 @@
PerlIO_printf(Perl_debug_log, "%sCompiling REx%s %s\n",
PL_colors[4],PL_colors[5],s);
});
-
+
redo_first_pass:
RExC_precomp = exp;
RExC_flags = pm_flags;
@@ -4381,18 +4380,20 @@
struct regnode_charclass_class ch_class; /* pointed to by data */
int stclass_flag;
I32 last_close = 0; /* pointed to by data */
-
- first = scan;
+ regnode *first= scan;
+ regnode *first_next= regnext(first);
+
/* Skip introductions and multiplicators >= 1. */
while ((OP(first) == OPEN && (sawopen = 1)) ||
/* An OR of *one* alternative - should not happen now. */
- (OP(first) == BRANCH && OP(regnext(first)) != BRANCH) ||
+ (OP(first) == BRANCH && OP(first_next) != BRANCH) ||
/* for now we can't handle lookbehind IFMATCH*/
(OP(first) == IFMATCH && !first->flags) ||
(OP(first) == PLUS) ||
(OP(first) == MINMOD) ||
/* An {n,m} with n>0 */
- (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) )
+ (PL_regkind[OP(first)] == CURLY && ARG1(first) > 0) ||
+ (OP(first) == NOTHING && PL_regkind[OP(first_next)] != END ))
{
if (OP(first) == PLUS)
@@ -4404,6 +4405,7 @@
first += EXTRA_STEP_2ARGS;
} else /* XXX possible optimisation for /(?=)/ */
first = NEXTOPER(first);
+ first_next= regnext(first);
}
/* Starting-point info. */
Index: D:/dev/perl/ver/zoro/t/op/re_tests
===================================================================
--- D:/dev/perl/ver/zoro/t/op/re_tests (revision 1874)
+++ D:/dev/perl/ver/zoro/t/op/re_tests (revision 1875)
@@ -1324,3 +1324,5 @@
foo(\h)bar foo\tbar y $1 \t
(\H)(\h) foo\tbar y $1-$2 o-\t
(\h)(\H) foo\tbar y $1-$2 \t-b
+
+.*\z foo\n y - -
Index: D:/dev/perl/ver/zoro/regexec.c
===================================================================
--- D:/dev/perl/ver/zoro/regexec.c (revision 1874)
+++ D:/dev/perl/ver/zoro/regexec.c (revision 1875)
@@ -1845,7 +1845,7 @@
if (regtry(®info, &s))
goto got_it;
after_try:
- if (s >= end)
+ if (s > end)
goto phooey;
if (prog->extflags & RXf_USE_INTUIT) {
s = re_intuit_start(prog, sv, s + 1, strend, flags, NULL);
|
@rgs - Status changed from 'open' to 'resolved' |
From @rgsOn 28/05/07, demerphq <demerphq@gmail.com> wrote:
Hic sunt leones. Thanks, applied as #31303. |
Migrated from rt.perl.org#43015 (status was 'resolved')
Searchable as RT43015$
The text was updated successfully, but these errors were encountered: