Jump to content

gamblehawk

New Members
  • Posts

    1
  • Joined

  • Last visited

gamblehawk's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.