{"ScriptPreparationCode":"function generateText(length, containsOtherChars) {\r\n return [].constructor(length)\r\n .map(it =\u003E Math.random() \u003E 0.5 ? \u0027,\u0027 : containsOtherChars \u0026\u0026 Math.random() \u003E 0.5 ? \u0027a\u0027 : \u0027 \u0027)\r\n .join(\u0022\u0022);\r\n}\r\n\r\nvar shortEmptyText = generateText(100, false);\r\nvar shortNonEmptyText = generateText(100, true);\r\n\r\nvar longEmptyText = generateText(1000 * 1000 * 10, false);\r\nvar longNonEmptyText = generateText(1000 * 1000 * 10, true);\r\n\r\nvar regex = /^[\\s,]*$/;","TestCases":[{"Name":"Short regex","Code":"console.log(!!shortEmptyText.match(regex)?.length);\r\nconsole.log(!!shortNonEmptyText.match(regex)?.length);","IsDeferred":false},{"Name":"Long regex","Code":"console.log(!!longEmptyText.match(regex)?.length);\r\nconsole.log(!!longNonEmptyText.match(regex)?.length);","IsDeferred":false},{"Name":"Short split and trim","Code":"var sanitizedEmptyText = shortEmptyText.split(\u0022,\u0022).filter(it =\u003E !!it?.trim()).join(\u0022\u0022);\r\nvar sanitizedNonEmptyText = shortEmptyText.split(\u0022,\u0022).filter(it =\u003E !!it?.trim()).join(\u0022\u0022);\r\nconsole.log(sanitizedEmptyText.length \u003E 0);\r\nconsole.log(sanitizedNonEmptyText.length \u003E 0);","IsDeferred":false},{"Name":"Long split and trim","Code":"var sanitizedEmptyText = longEmptyText.split(\u0022,\u0022).filter(it =\u003E !!it?.trim()).join(\u0022\u0022);\r\nvar sanitizedNonEmptyText = longNonEmptyText.split(\u0022,\u0022).filter(it =\u003E !!it?.trim()).join(\u0022\u0022);\r\nconsole.log(sanitizedEmptyText.length \u003E 0);\r\nconsole.log(sanitizedNonEmptyText.length \u003E 0);","IsDeferred":false}]}