Hi I noticed a very interesting behavior in JavaScript RegEx.exec function. if I run the same regex multiple times on a string that returns positive, it will return positive only half of the time.. (I don't need to use .test) I do need to capture some values from an input string.
I am using Chrome 45.0.2454.93.
var x = new RegExp("12|11","gi"); console.log(x.exec("11,1,5,0")); // OK returns 11 console.log(x.exec("11,1,5,0")); // NULL console.log(x.exec("11,1,5,0")); // OK returns 11 console.log(x.exec("11,1,5,0")); // NULL console.log(x.exec("11,1,5,0")); // OK returns 11 console.log(x.exec("11,1,5,0")); // NULL
I will up-vote a good explanation of this behavior.
Regards Erik.