{"ScriptPreparationCode":null,"TestCases":[{"Name":"regex","Code":"const escapedText = \u0027\\ P\u0027.replace(/[.|*|\u002B|?|^|$|{|}|(|)|[|]|\\||\\\\]/g, \u0027\\\\$\u0026\u0027);\r\nconst searchRegex = new RegExp(escapedText, \u0027gi\u0027);\r\nconst count = (\u0027\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\u0027.match(searchRegex)).length;","IsDeferred":false},{"Name":"split","Code":"const count = (\u0027\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\u0027.split(\u0027\\ P\u0027)).length;","IsDeferred":false},{"Name":"loop","Code":"const string = \u0027\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\\ P\u0027;\r\nconst searchFor = \u0027\\ P\u0027;\r\nlet count = 0;\r\nlet pos = string.indexOf(searchFor);\r\n\r\nwhile (pos \u003E -1) {\r\n \u002B\u002Bcount;\r\n pos = string.indexOf(searchFor, \u002B\u002Bpos);\r\n}","IsDeferred":false}]}