title: Regular expression in PHP for finding whole words
body: <p>I want a code in PHP with regular expressions that returns whole words for any matches. For example if search for <code>ac</code> I want it returns all words in a string that have <code>ac</code> in any part. i.e. if the String have <code>facebook</code> or <code>act</code> or <code>face</code> it returns all the words to me, I wrote this code but does not work properly. </p>
  
  <pre><code>$regx = "/\\b(\\S)*ac(\\S)*/iu"; 
      foreach($values as $value) 
      {
          echo $value."\n";
          preg_match_all($regx, $value, $matches,PREG_PATTERN_ORDER);
          var_dump($matches);
      }
  </code></pre>