Page 1 of 1

preg_match help

Posted: Wed May 30, 2012 8:45 am
by dimxasnewfrozen
So I have a result from an API call and my skills in regular expressions and preg_match() are limited.

The result looks like this:
[{"county_name":"Albany","description":null"}]

This obviously doesn't work because I'm not too good with regex stuff

Code: Select all

if (preg_match('{"county_name":"', $content, $result))  {
            	$county = $result[1];
}
So I need the county name out of the string.

Re: preg_match help

Posted: Wed May 30, 2012 9:19 am
by Celauran
Looks like JSON, so you may want to take a peek at json_decode().