split from this thread
How would I make this regex also check for a specific term / string?
preg_match_all('/(?<=[.?!]|^).*?(?=([.?!])\s{0,3}[A-Z]|$)/s',$content,$matches);
echo "<pre>";
for($i=0;$i<count($matches[0]);$i++)
$result[] = trim($matches[0][$i]).$matches[1][$i];
print_r($result);
}
preg_match_all('/(?<=[.?!]|^).*?(?=([.?!])\s{0,3}[A-Z]|$)/s',$content,$matches);As in using brackets to specify a string to check is in the sentence
('.$search.')So, just to make it clear:-Getting only sentences
-And also making sure the sentences contain a specific string ($search)
preg_match_all('/(?<=[.?!]|^).*?(?=([.?!])\s{0,3} == I would assume the ($search) goes somewhere here in the middle == [A-Z]|$)/s',$content,$matches);