|
<script language="javascript">
var Re = /[0-9]/;
document.write(Re.test("0"));
document.write(Re.test("0"));
document.write(Re.test("0"));
</script>
结果为true true true;
而
<script language="javascript">
var Re = /[0-9]/g;
document.write(Re.test("0"));
document.write(Re.test("0"));
document.write(Re.test("0"));
</script>
的结果却是true false true.
相差一个[g],为什么会这样?
谢谢! |
|