我在JavaScript中有下面的正則表達式:JavaScript正異常匹配字符串一旦在Chrome和Firefox
var the_regexp = /^\/([!\/]*)\/?(\w*)\??([\=|\w]*)\/?$/gi
它Firefox和Chrome的控制檯,它找到字符串匹配「/ d」每兩次嘗試一次。
>the_regexp
/^\/([!\/]*)\/?(\w*)\??([\=|\w]*)\/?$/gi
>the_regexp.exec("/d")
null
>the_regexp.exec("/d")
["/d", "", "d", ""]
>the_regexp.exec("/d")
null
>the_regexp.exec("/d")
["/d", "", "d", ""]
有人可以解釋這種行爲嗎?