title: Regex to check if exact string exists
body: <p>I am looking for a way to check if an exact string match exists in another string using Regex or any better method suggested. I understand that you tell regex to match a space or any other non-word character at the beginning or end of a string. However, I don't know exactly how to set it up.</p>
  
  <p>Search String: <code>t</code></p>
  
  <p>String 1: <code>Hello World, Nice to see you! t</code><br>
  String 2: <code>Hello World, Nice to see you!</code><br>
  String 3: <code>T Hello World, Nice to see you!</code>  </p>
  
  <p>I would like to use the search string and compare it to String 1, String 2 and String 3 and only get a positive match from String 1 and String 3 but not from String 2.</p>
  
  <p>Requirements:<br>
  Search String may be at any character position in the Subject.<br>
  There may or may not be a white-space character before or after it.<br>
  I do not want it to match if it is part of another string; such as part of a word.</p>
  
  <p>For the sake of this question:
  I think I would do this using this pattern: <code>/\bt\b/gi</code>  </p>
  
  <p><code>/\b{$search_string}\b/gi</code>  </p>
  
  <p>Does this look right? Can it be made better? Any situations where this pattern wouldn't work?<br>
  Additional info: this will be used in PHP 5</p>