I want to extract text from $_SERVER['HTTP_REFERER']
let's say
$_SERVER['HTTP_REFERER'] = http://www.google.com/search?source=ig&hl=en&rlz=&q=something+i+am+looking+for&aq=f&oq=&aqi=
then I want $query equal "something+i+am+looking+for". I figure I can use pregreplace so I can say
$query=preg_replace([some regex], ,$_SERVER['HTTP_REFERER']);
And the regex should mean "anything that is after '&q=' and before '&aq'". How can I write this as regex?