Jump to content

Need help with a simple Regular Expression and preg_match


vestaxpdx

Recommended Posts

Hi,

 

I have this string

 

$my_string = "AND country='United Kingdom' OR country='France' OR country='Spain'";

 

I simply want to return the counties, so grab everything inside country=' ... '

 

I just cant figure out the reg expression. Sorry if this is mega easy. I would really appreciate some help.

 

My code so far is:

 

$my_string = "AND country='United Kingdom' OR country='France' OR country='Spain'";
$pattern = "";
preg_match($pattern, $my_string, $matches);
print_r($matches);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.