title: Why does the JavaScript String whitespace character &nbsp; not match?
body: <p>I got in HTML the following construct:</p>
  <pre class="lang-html prettyprint-override"><code>&lt;div id=&quot;text&quot;&gt;
    some&amp;nbsp;text
  &lt;/div&gt;
  </code></pre>
  <p>If I trim the text and test it with:</p>
  <pre class="lang-js prettyprint-override"><code>$(&quot;#text&quot;).text().trim() === &quot;some text&quot;
  </code></pre>
  <p>it returns <code>false</code>, also:</p>
  <pre class="lang-js prettyprint-override"><code>$(&quot;#text&quot;).text().trim() === &quot;some&amp;nbsp;text&quot;
  </code></pre>
  <p>returns <code>false</code>, but:</p>
  <pre class="lang-js prettyprint-override"><code>/^some\s{1}text$/.test($(&quot;#text&quot;).text().trim())
  </code></pre>
  <p>returns <code>true</code>.
  So please tell me, what´s wrong here.</p>
  <p>As you would suggest, I am using jQuery (1.6).</p>