*
**** Alterations to Henry's code are...
****
- **** Copyright (c) 1991-1994, Larry Wall
+ **** Copyright (c) 1991-1997, Larry Wall
****
**** You may distribute under the terms of either the GNU General Public
**** License or the Artistic License, as specified in the README file.
/* If there is a "must appear" string, look for it. */
s = startpos;
if (prog->regmust != Nullsv &&
- (!(prog->reganch & ROPT_ANCH)
+ !(prog->reganch & ROPT_ANCH_GPOS) &&
+ (!(prog->reganch & ROPT_ANCH_BOL)
|| (multiline && prog->regback >= 0)) )
{
if (stringarg == strbeg && screamer) {
regtill = startpos+minend;
/* Simplest case: anchored match need be tried only once. */
- /* [unless multiline is set] */
+ /* [unless only anchor is BOL and multiline is set] */
if (prog->reganch & ROPT_ANCH) {
if (regtry(prog, startpos))
goto got_it;
- else if (multiline || (prog->reganch & ROPT_IMPLICIT)) {
+ else if (!(prog->reganch & ROPT_ANCH_GPOS) &&
+ (multiline || (prog->reganch & ROPT_IMPLICIT)))
+ {
if (minlen)
dontbother = minlen - 1;
strend -= dontbother;
s++;
}
}
- else if (SvPOK(prog->regstart) == 3) {
+ else if (SvTYPE(prog->regstart) == SVt_PVBM) {
/* We know what string it must start with. */
while ((s = fbm_instr((unsigned char*)s,
(unsigned char*)strend, prog->regstart)) != NULL)
s++;
}
}
- else {
+ else { /* Optimized fbm_instr: */
c = SvPVX(prog->regstart);
while ((s = ninstr(s, strend, c, c + SvCUR(prog->regstart))) != NULL)
{
if (locinput == regbol && regprev == '\n')
break;
sayNO;
- case GBOL:
+ case GPOS:
if (locinput == regbol)
break;
sayNO;
#ifdef DEBUGGING
if (regnarrate)
- PerlIO_printf(Perl_debug_log, "%*s %d %lx\n", regindent*2, "",
- n, (long)cc);
+ PerlIO_printf(Perl_debug_log, "%*s %ld %lx\n", regindent*2, "",
+ (long)n, (long)cc);
#endif
/* If degenerate scan matches "", assume scan done. */
- if (locinput == cc->lastloc) {
+ if (locinput == cc->lastloc && n >= cc->min) {
regcc = cc->oldcc;
ln = regcc->cur;
if (regmatch(cc->next))
sayNO;
break;
default:
- PerlIO_printf(PerlIO_stderr(), "%x %d\n",(unsigned)scan,scan[1]);
+ PerlIO_printf(PerlIO_stderr(), "%lx %d\n",
+ (unsigned long)scan, scan[1]);
FAIL("regexp memory corruption");
}
scan = next;