``` let x = /script/gi; console.log(x.test("script")); // true console.log(x.test("script")); // false console.log(x.test("script")); // true console.log(x.test("script")); // false ``` this is due to the nature of `lastIndex`, which is set when using a global `RegExp` (see 12.a in <https://tc39.es/ecma262/#sec-regexpbuiltinexec>)
Created attachment 396795 [details] Patch
Created attachment 396797 [details] Patch use better names :P
<rdar://problem/61950043>
Committed r260291: <https://trac.webkit.org/changeset/260291> All reviewed patches have been landed. Closing bug and clearing flags on attachment 396797 [details].
(In reply to Devin Rousso from comment #0) > ``` > let x = /script/gi; > console.log(x.test("script")); // true > console.log(x.test("script")); // false > console.log(x.test("script")); // true > console.log(x.test("script")); // false > ``` > > this is due to the nature of `lastIndex`, which is set when using a global > `RegExp` (see 12.a in <https://tc39.es/ecma262/#sec-regexpbuiltinexec>) Wut.