title: Regexp.match.length returns NULL if not found
body: <p>I have a JS regexp.</p>
  <pre><code>var t1 = str.match(/\[h1\]/g).length;
  </code></pre>
  <p>If <code>str</code> contains the word <code>[h1]</code> it works fine else it shows an error!<br />
  How to solve the problem?</p>