in reply to
Re: Quirky regex bug
in thread Quirky regex bug
Yes. From the source (regcomp.c:1851):
else if (!sawopen && (OP(first) == STAR &&
PL_regkind[(U8)OP(NEXTOPER(first))] == REG_ANY) &&
!(r->reganch & ROPT_ANCH) )
{
/* turn .* into ^.* with an implied $*=1 */
/* ... */
}
So you can see it is
only for regexes starting with
.* -- if you look a few lines up, you see:
/* Skip introductions and multiplicators >= 1. */
while ((OP(first) == OPEN && (sawopen = 1)) ||
/* ... */
) { /* ... */ }
So it's ignoring the fact that the
.* might actually be inside parens.
My patch consisted of the text "!sawparen &&" in the code block up top. Big patch, I know.
_____________________________________________________
Jeff[japhy]Pinyan:
Perl,
regex,
and perl
hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;