正则表达是RegExp.test()方法 不同浏览器的支持效果不同
可能是ie 的一个bug .
g全局标志 不能乱加?
下面的代码拷贝到不同的浏览器 中效果完全不同 Ns/firefox 与ie
<SCRIPT LANGUAGE="JavaScript">
<!--
var a=["e","e","e","e" ,"e","e","e"];
the_pattern =/e*/i;
var pattern = new RegExp(the_pattern); //构建表达对象
for (var i = 0; i < a.length; i++) {
document.write( pattern.test(a[i] ) + " " + a[i] +"<p>" );}
//-->
</SCRIPT>
<HR>
<SCRIPT LANGUAGE="JavaScript">
<!--
var a=["e","e","e","e" ,"e","e"];
the_pattern =/e*/gi;
var pattern = new RegExp(the_pattern); //构建表达对象
for (var i = 0; i < a.length; i++) {
document.write( pattern.test(a[i] ) + " " + a[i] +"<p>" );}
//-->
</SCRIPT>