{"ScriptPreparationCode":"function getCookie(name) {\r\n var nameEQ = name \u002B \u0022=\u0022;\r\n var ca = document.cookie.split(\u0022;\u0022);\r\n for (var i = 0; i \u003C ca.length; i\u002B\u002B) {\r\n var c = ca[i];\r\n while (c.charAt(0) == \u0022 \u0022) c = c.substring(1, c.length);\r\n if (c.indexOf(nameEQ) == 0) {\r\n var d = c.substring(nameEQ.length, c.length);\r\n d = decodeURIComponent(d);\r\n return d;\r\n }\r\n }\r\n return undefined;\r\n}\r\n\r\nfunction getCookieM(name) {\r\n name = name \u002B \u0022\u0022;\r\n var re = new RegExp(\u0022(^| )\u0022 \u002B name \u002B \u0022=([^;]\u002B)\u0022, \u0022gmi\u0022);\r\n var m = document.cookie.match(re) || undefined;\r\n if (!!m) {\r\n m = m.pop();\r\n m = m.substring(m.indexOf(\u0022=\u0022)\u002B1);\r\n m = !!m ? decodeURIComponent(m) : m;\r\n }\r\n return m;\r\n}\r\n\r\ndocument.cookie = \u0022foo=bar\u0022;\r\ndocument.cookie = \u0022foo=nope;domain=measurethat.net\u0022;","TestCases":[{"Name":"String","Code":"getCookie(\u0027foo\u0027)","IsDeferred":false},{"Name":"Regex","Code":"getCookieM(\u0027foo\u0027)","IsDeferred":false}]}