title: Get word from string - PHP
body: <p>I am trying to extract a word that matches a specific pattern from various strings.</p>
  
  <p>The strings vary in length and content.</p>
  
  <p>For example:</p>
  
  <p>I want to extract any word that begins with jac from the following strings and populate an array with the full words:</p>
  
  <ul>
  <li>I bought a jacket yesterday.</li>
  <li>Jack is going home.</li>
  <li>I want to go to Jacksonville.</li>
  </ul>
  
  <p>The resulting array should be [jacket,Jack,Jacksonville]</p>
  
  <p>I have been trying to use preg_match() but for some reason it won't work. Any suggestions???</p>
  
  <pre><code>$q = "jac";
  $str = "jacket";
  preg_match($q,$str,$matches);
  
  print $matches[1];
  </code></pre>
  
  <p>This returns null :S. I dunno what the problem is.</p>