Want to pull the data between two words
Posted: Fri May 22, 2009 11:44 am
I have the following pattern:
It returns "Country: United States (XX) City: ". I only want the regular expression to return: "United States (XX)". How can this be done?
Code: Select all
$regexp = "/Country: .* City: /";
if (preg_match($regexp, "Country: United States (XX) City: (Unknown City?) ", $matches)) {
echo "Match was found <br />";
echo $matches[0];
}