$re = '/(\?|\&)([a-z_]+=)([a-z])([^&]+)/';
$str = 'https://www.google.com/search?q=hello+there&oq=hello+there&aqs=chrome..69i57j0l5.2394j0j7&sourceid=chrome&es_sm=122&ie=UTF-8&qscrl=1';
$subst = "$1$2$3$4";
$result = preg_replace($re, $subst, $str);
echo "The result of the substitution is ".$result;
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php