⟩ How do I retrieve a cookie with a given name using a regular expression?
You can use readCookie() function to read the cookie. It provides sufficient arguments that one can find it, flexible to use. It takes cookieName as a parameter and other statements in the block. Below function uses the cookie function as well as regular expression to show the functionality:
function readCookie(cookieName)
{ var rx = new RegExp('[; ]'+cookieName+'=([^s;]*)');
var sMatch = (' '+document.cookie).match(rx);
if (cookieName && sMatch) return unescape(sMatch[1]);
return '';
}