having a little trouble with this expression....im very new to regular expressions, so its no wonder im having trouble.
As you can see (when u run this script) im getting no output.
the problem seems to be the fullstop (.)
how do i get the array to return the word 'lambs.'?
even when i try escape the full stop, its like the stop is still stuffing things up...what am i missing?
function findinside($start, $end, $string) {
preg_match_all('/' . preg_quote($start, '/') . '([^\.)]+)'. preg_quote($end, '/').'/i', $string, $m);
return $m[1];
}
$start = "13";
$end = "mary";
$string = "mary has 6 lambs. phil has 13 lambs. mary stole phil's lambs. now mary has all the lambs.";
$out = findinside($start, $end, $string);
print_r ($out);