{"ScriptPreparationCode":"function regex(s, re) {\r\n var r = s.match(re);\r\n if (r) return r.length;\r\n return 0;\r\n}\r\n\r\nfunction split(s, oc) {\r\n return s.split(oc).length - 1;\r\n}\r\n\r\nfunction indexOf(s, oc) {\r\n var i = 0, count = 0;\r\n while ((i = s.indexOf(oc, i)) \u003E= 0) {\r\n count\u002B\u002B;\r\n i\u002B\u002B;\r\n }\r\n return count;\r\n}","TestCases":[{"Name":"Use regex","Code":"window.result = regex(\u0022This is a pen\u0022, /is/g);","IsDeferred":false},{"Name":"Use split","Code":"window.result = split(\u0022This is a pen\u0022, \u0022is\u0022);","IsDeferred":false},{"Name":"Use indexOf","Code":"window.result = indexOf(\u0022This is a pen\u0022, \u0022is\u0022);","IsDeferred":false}]}