Just need to see if a paragraph contains a "stop word", the stop words are in an array below.
I had the formula as:
$pattern_array = array("preheat", "minutes", "stir", "heat", "put", "beat", "bowl", "pan");
foreach ($pattern_array as $pattern) {
if (preg_match('/'.$pattern.')/i', $paragraph)) {
$stopwords = 1;
}
}
Which works well enough but for short words like 'pan' a word like 'panko' is identified as a stop word.
So the regex would be something like it has to have a space before it or be the start of a new line and either end in a full stop/space/comma/(other non character objects).
Also how could I tell php to exit the loop as soon as a stop word is identified?
Thanks guys, slowing learning regex as I go!