From: Hugo van der Sanden Date: Fri, 23 Nov 2001 15:15:24 +0000 (+0000) Subject: Re: regex oddness with \Z and $& X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a1917ab96472a0f938aee4646d539e070dc12cd3;p=p5sagit%2Fp5-mst-13.2.git Re: regex oddness with \Z and $& Message-Id: <200111231515.fANFFOR10341@crypt.compulink.co.uk> p4raw-id: //depot/perl@13198 --- diff --git a/regcomp.c b/regcomp.c index 12e0395..3eb4e39 100644 --- a/regcomp.c +++ b/regcomp.c @@ -2795,6 +2795,7 @@ tryagain: case 'Z': ret = reg_node(pRExC_state, SEOL); *flagp |= SIMPLE; + RExC_seen_zerolen++; /* Do not optimize RE away */ nextchar(pRExC_state); break; case 'z': diff --git a/t/op/re_tests b/t/op/re_tests index 1e80f50..c7ab5ad 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -537,7 +537,7 @@ a$ b\na\n y $-[0] 2 a\Z b\na y $-[0] 2 a\z b\na y $-[0] 2 a$ b\na y $-[0] 2 -'a\Z'm a\nb\n bn - - +'a\Z'm a\nb\n n - - 'a\z'm a\nb\n n - - 'a$'m a\nb\n y $-[0] 0 'a\Z'm b\na\n y $-[0] 2 @@ -555,7 +555,7 @@ aa$ b\naa\n y $-[0] 2 aa\Z b\naa y $-[0] 2 aa\z b\naa y $-[0] 2 aa$ b\naa y $-[0] 2 -'aa\Z'm aa\nb\n bn - - +'aa\Z'm aa\nb\n n - - 'aa\z'm aa\nb\n n - - 'aa$'m aa\nb\n y $-[0] 0 'aa\Z'm b\naa\n y $-[0] 2 @@ -609,7 +609,7 @@ ab$ b\nab\n y $-[0] 2 ab\Z b\nab y $-[0] 2 ab\z b\nab y $-[0] 2 ab$ b\nab y $-[0] 2 -'ab\Z'm ab\nb\n bn - - +'ab\Z'm ab\nb\n n - - 'ab\z'm ab\nb\n n - - 'ab$'m ab\nb\n y $-[0] 0 'ab\Z'm b\nab\n y $-[0] 2 @@ -663,7 +663,7 @@ abb$ b\nabb\n y $-[0] 2 abb\Z b\nabb y $-[0] 2 abb\z b\nabb y $-[0] 2 abb$ b\nabb y $-[0] 2 -'abb\Z'm abb\nb\n bn - - +'abb\Z'm abb\nb\n n - - 'abb\z'm abb\nb\n n - - 'abb$'m abb\nb\n y $-[0] 0 'abb\Z'm b\nabb\n y $-[0] 2