I am using preg_replace to remove some content from a string. What I am wondering is if there is a way to keep the stuff that is removed in a different variable. Here is what I am using:
$city = preg_replace('/^([0-9]* \w+ )?(.*)$/', '$2', $content[2]);
Run a preg_match() first to get the content which will be replaced, and then replace the content as you do.