Something strange about regular expression
<pre><code>var str = "{$ for ( var i = 0, len = O.length; i &lt; len; i++ ) { $}";

var reg = /\{\$(.*?)\$\}/g;

console.log(reg.test(str));

console.log(reg.test(str));

console.log(reg.test(str));
</code></pre>

<p>who can tell me why the result is true and false alternation;</p>

<p>thanks very mush</p>
