Python regex group clarification
Posted
by nkr1pt
on Stack Overflow
See other posts from Stack Overflow
or by nkr1pt
Published on 2010-03-27T20:20:24Z
Indexed on
2010/03/27
20:23 UTC
Read the original article
Hit count: 576
I have 0 experience with python, very little with regex and I'm trying to figure out what this small snippet of python regex would give back from a http response header Set-Cookie entry:
REGEX_COOKIE = '([A-Z]+=[^;]+;)'
resp = urllib2.urlopen(req)
re.search(REGEX_COOKIE, resp.info()['Set-Cookie']).group(1)
Can one give a simple example of a Set-Cookie value and explain what this would match on + return?
Regards
© Stack Overflow or respective owner