I have a string variable whose data looks something like this:
a:15:{s:6:"status";s:6:"Active";s:9:"checkdate";s:8:"20130807";s:11:"companyname";s:4:"test";s:11:"validdomain";s:19:"test";s:7:"md5hash";s:32:"501yd361fe10644ea1184412c3e89dce";s:7:"regdate";s:10:"2013-08-06";s:14:"registeredname";s:10:"TestName";s:9:"serviceid";s:1:"8";s:11:"nextduedate";s:10:"0000-00-00";s:12:"billingcycle";s:8:"OneTime";s:7:"validip";s:15:"xxx.xxx.xxx.xxx";s:14:"validdirectory";s:5:"/root";s:11:"productname";s:20:"SomeProduct";s:5:"email";s:19:"testmail@test.com";s:9:"productid";s:1:"1";}
I am trying to extract the quoted data into a dictionary as a key-value pair like so:
{"status":"Active","checkdate":20130807,.............}
I tried extracting it using the following:
tempkeyresults = re.findall('"(.*?)"([^"]+)</\\1>', localdata, flags=re.IGNORECASE)
I'm quite new to regex and I assume what I am trying to query translates to "find and extract all data between " and " and extract it before the next "..." However, this returns and empty string([]). Could someone tell me where I am wrong?
Thanks in advance