js 代码:var reg =/([1-2]\d{3})\/|-\/|-/ig ;
alert(reg.test("2013-01-16"));////true
alert(reg.test("2013-01-16"));////false
[color=darkblue]把reg的g修饰符去除或者第二次及之后test前执行reg.lastIndex =0[/color]
[url]http://stackoverflow.com/questions/1520800/why-regexp-with-global-flag-in-javascript-give-wrong-results[/url]