title: Why does the 'g' flag change the result of a JavaScript regular expression?
body: <p>Consider:</p>
  
  <pre><code>var reg = new RegExp("^19[-\\d]*","g");
  reg.test('1973-02-01') // true
  reg.test('1973-01-01') // false
  </code></pre>
  
  <p>Why does the third line return <code>false</code>? If I remove the "g" flag, then it returns <code>true</code>.</p>