title: Javascript .match plus jQuery keyup(), double match and strange behaviour
body: <p>Not really good in regular expression, but why when a match is found <code>console.log</code> fires two times?</p>
  
  <pre><code>$('#name').keyup(function() {
      var regex = /[\€]/g;
      var count = (m = $(this).val().match(regex)) ? m.length : 0; // Num matches
      console.log(count);
  });
  </code></pre>
  
  <p>Output with 'hello':</p>
  
  <pre><code>0
  0
  0
  0
  0
  </code></pre>
  
  <p>After adding '€' symbol to 'hello' we have:</p>
  
  <pre><code>0
  0
  0
  0
  0
  1
  1
  </code></pre>
  
  <p>After adding 'h' symbol to 'hello€' we have:</p>
  
  <pre><code>0
  0
  0
  0
  0
  1
  1
  1
  </code></pre>
  
  <p>Shouldn't be just one <code>1</code> after adding '€' to 'hello'?</p>