} else {
STRLEN len;
char *little = SvPV(prog->float_substr, len);
- last = rninstr(s, strend, little, little + len);
+ if (len)
+ last = rninstr(s, strend, little, little + len);
+ else
+ last = strend; /* matching `$' */
}
if (last == NULL) goto phooey; /* Should not happen! */
- dontbother = strend - last - 1;
+ dontbother = strend - last + prog->float_min_offset;
}
if (minlen && (dontbother < minlen))
dontbother = minlen - 1;
goto phooey;
got_it:
- strend += dontbother; /* uncheat */
prog->subbeg = strbeg;
- prog->subend = strend;
+ prog->subend = PL_regeol; /* strend may have been modified */
RX_MATCH_TAINTED_set(prog, PL_reg_flags & RF_tainted);
/* make sure $`, $&, $', and $digit will work later */
}
}
else {
- I32 i = strend - startpos + (stringarg - strbeg);
+ I32 i = PL_regeol - startpos + (stringarg - strbeg);
s = savepvn(strbeg, i);
Safefree(prog->subbase);
prog->subbase = s;