title: Regex to match words starting with hyphen
body: <p>I have a regex which does all matches except one match.The PHP Code for the word match is:</p>
  
  <pre><code>$string = preg_replace("/\b".$wordToMatch."\b/","&lt;span class='sp_err' style='background-color:yellow;'&gt;".$wordToMatch."&lt;/span&gt;",$string); 
  </code></pre>
  
  <p>Here in the above regex when the $wordToMatch variable value becomes "-abc" and the $string value is "The word -abc should match and abc-abc should not match".With above regex it fails to catch "-abc".</p>
  
  <ul>
  <li>I want enhancement in the above regex so that it can catch "-abc" in $string,but if it tries to match "-abc" in "abc-abc" of $string it should not.  </li>
  </ul>