title: Another tricky preg_match
body: <p>Just need to see if a paragraph contains a "stop word", the stop words are in an array below.</p>
  
  <p>I had the formula as:</p>
  
  <pre><code>$pattern_array = array("preheat", "minutes", "stir", "heat", "put", "beat", "bowl", "pan");
  
      foreach ($pattern_array as $pattern) {
        if (preg_match('/'.$pattern.')/i', $paragraph)) {
          $stopwords = 1;
        }
      }
  </code></pre>
  
  <p>Which works well enough but for short words like 'pan' a word like 'panko' is identified as a stop word.</p>
  
  <p>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).</p>
  
  <p>Also how could I tell php to exit the loop as soon as a stop word is identified?</p>
  
  <p><strong>Thanks guys, slowing learning regex as I go!</strong></p>