You can clone with
No one assigned
Hi all, i recently ran into the following behavior that testing via regexe.test() is not working as aspected. Here is my "stripped test procedure" that i have checked with node 10.0 on FreeBSD and 10.2 on MacOS
var t = /link|meta/g;
var elements = ['link','link','link']
var i = elements.length;
console.log( elements[i], t.test(elements[i]));
My expected result is:
but the following comes alive:
Removing the global modifier "g" returns the expected result ...
Happy Bugfixing! (i just tried to find the code for the behavior and wanted to fix it by myself but there was to much code and i'm to little experienced)
That's well-known ECMAscript "feature". Quote from MDN:
test called multiple times on the same global regular expression instance
will advance past the previous match.
I'm afraid there's nothing we can do about it, but thanks for reporting anyway!