ughfml Posted March 7, 2011 Share Posted March 7, 2011 I'm trying to get data out of a cookie. sometimes its like NEW_LIST=4; and sometimes NEW_LIST=4 (without semicolon) my regex is /NEW_LIST(.+)[^;]*/ but it seems to not be working... as u can see im trying to get the cookie data for NEW_LIST. Quote Link to comment https://forums.phpfreaks.com/topic/229866-regex/ Share on other sites More sharing options...
RussellReal Posted March 7, 2011 Share Posted March 7, 2011 you don't need regex try this.. function cookies() { var x = document.cookie.split(';'), ret = new Object(); for (i in x) { ret[x[i].split('=')[0]] x[i].split('=')[1]; } return ret; } // untested now you can use that like this: cookies().NEW_LIST; Quote Link to comment https://forums.phpfreaks.com/topic/229866-regex/#findComment-1184035 Share on other sites More sharing options...
ughfml Posted March 8, 2011 Author Share Posted March 8, 2011 Thanks so much Quote Link to comment https://forums.phpfreaks.com/topic/229866-regex/#findComment-1184300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.