title: startsWith endsWith matches contains regular expression
body: <p>I'm iterating through an array list of voice data to decipher if the user answered 'yes' or 'no'. Simple hey...</p>
  
  <p>This is the initial check I have to detect an unclear response that contains both 'yes' and 'no'. It works perfectly, but just looking at it, I know I should be embarrassed to post it and it can be greatly simplified!</p>
  
  <pre><code>    if ((element.toString().startsWith("yes ")
      || element.toString().endsWith(" yes")
      || element.toString().contains(" yes "))
      &amp;&amp; (element.toString().startsWith("no ")
      || element.toString().endsWith(" no")       
      || element.toString().contains(" no "))) {
  
      // I heard both yes and no - inform user I don't understand
  </code></pre>
  
  <p>I want the user to be able to accept or decline using whatever natural speech they desire and therefore need to consider the unlikely eventualities of the following appearing in the array data:</p>
  
  <ul>
  <li>yes no</li>
  <li>sey on</li>
  <li>yes knocking</li>
  <li>yesterday no</li>
  <li>yesterday knocking</li>
  <li>bayes theorem porno</li>
  </ul>
  
  <p>I've been through so many regular expression posts and tutorials, but no matter what I do, I cannot find a solution that works better than the posted code. The white space [\\s] being there or '|' not, I can't resolve...</p>
  
  <p>I thank you in advance for your help!</p>