The test function of the regular expression returns an invalid value when the 'g' flag is present.
Example:
var regExpArh = /(\.rar|\.zip|\.7z)$/gi;
var s = "55.7z";
regExpArh.test(s); // return true
regExpArh.test(s); // return false
regExpArh.test(s); // return true
regExpArh.test(s); // return false
Why?