我一直在調試這一個應用程序一段時間,它引導我到這個測試用例。當我在firefox 3.6.x中運行它時,它只能運行50%的時間。firefox 3.6.20正則表達式給出不一致的結果
var success = 0;
var pat = /(\d{2})\/(\d{2})\/(\d{4})\s(\d{2}):(\d{2})\s(am|pm)/g;
var date = "08/01/2011 12:00 am";
for(var i=0;i<100;i++) if(pat.exec(date)) success++;
alert("success: " + success + " failed: " + (100 - success));
它提醒success: 50 failed: 50
這是怎麼回事呢?