{"ScriptPreparationCode":"function findAll(regexPattern, sourceString) {\r\n let output = []\r\n let match\r\n // make sure the pattern has the global flag\r\n let regexPatternWithGlobal = RegExp(regexPattern,\u0022gi\u0022)\r\n while (match = regexPatternWithGlobal.exec(sourceString)) {\r\n // get rid of the string copy\r\n delete match.input\r\n // store the match data\r\n output.push(match)\r\n } \r\n return output\r\n}\r\n\r\nfunction findAllCase(regexPattern, sourceString) {\r\n let output = []\r\n let match\r\n // make sure the pattern has the global flag\r\n let regexPatternWithGlobal = RegExp(regexPattern,\u0022gi\u0022)\r\n while (match = regexPatternWithGlobal.exec(sourceString)) {\r\n // get rid of the string copy\r\n delete match.input\r\n // store the match data\r\n output.push(match)\r\n } \r\n return output\r\n}\r\n\r\nvar find = \u0027a\u0027;\r\nvar str = \u0027asdqwe\u0027.repeat(10000);","TestCases":[{"Name":"exec","Code":"findAll(find, str);","IsDeferred":false},{"Name":"match","Code":"str.match(RegExp(find, \u0027gi\u0027));","IsDeferred":false},{"Name":"exec case","Code":"findAllCase(find, str);","IsDeferred":false}]}