{"ScriptPreparationCode":"const cardMin = 12\r\nconst cardMax = 19\r\nconst cardSeparators = [\u0027.\u0027, \u0027_\u0027, \u0027-\u0027, \u0027 \u0027]\r\n\r\nwindow.filterCardsViaLoop = (str) =\u003E {\r\n if (str.length \u003C cardMin) {\r\n return []\r\n }\r\n let nl = 0\r\n let ns = -1\r\n let i = 0\r\n const ni = []\r\n while (i \u003C str.length) {\r\n if ((str.length - i) \u002B nl \u003C cardMin) {\r\n return ni\r\n }\r\n const c = str[i]\r\n const cc = c.charCodeAt(0)\r\n const isN = cc \u003E= 48 \u0026\u0026 cc \u003C= 57\r\n const isS = cardSeparators.includes(c)\r\n if (isN) {\r\n if (nl === 0) {\r\n ns = i\r\n }\r\n nl \u002B= 1\r\n } else if (!isS) {\r\n if (nl \u003E= cardMin \u0026\u0026 nl \u003C= cardMax) {\r\n ni.push([ns, i - 1])\r\n }\r\n nl = 0\r\n }\r\n i \u002B= 1\r\n }\r\n if (nl \u003E= cardMin \u0026\u0026 nl \u003C= cardMax) {\r\n ni.push([ns, i])\r\n }\r\n return ni\r\n}\r\n\r\nconst regex = /[0-9 ]{12,19}/g\r\nwindow.filterCardsViaRegex = (str) =\u003E {\r\n const ni = []\r\n while (true) {\r\n const matches = regex.exec(str)\r\n if (!matches) {\r\n break;\r\n }\r\n const lastIndex = regex.lastIndex\r\n ni.push([lastIndex, lastIndex \u002B matches[0].length])\r\n i \u002B= 1\r\n }\r\n return ni\r\n}","TestCases":[{"Name":"Match via loop","Code":"filterCardsViaLoop(\u0027this string has a pan here =\u003E 411111111111 \u003C=\u0027)","IsDeferred":false},{"Name":"Match via regex","Code":"filterCardsViaRegex(\u0027this string has a pan here =\u003E 411111111111 \u003C=\u0027)","IsDeferred":false}]}