diff --git a/inc/common.php b/inc/common.php
index 25dffdf948b43fd71b54efe7d08cff4550b93cd8..3cacc8ec06f67d79ce9060368468703196a7bec2 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -986,15 +986,17 @@ function getGoogleQuery(){
   $query = array();
   parse_str($url['query'],$query);
   if(isset($query['q']))
-    return $query['q'];        // google, live/msn, aol, ask, altavista, alltheweb, gigablast
+    $q = $query['q'];        // google, live/msn, aol, ask, altavista, alltheweb, gigablast
   elseif(isset($query['p']))
-    return $query['p'];        // yahoo
+    $q = $query['p'];        // yahoo
   elseif(isset($query['query']))
-    return $query['query'];    // lycos, netscape, clusty, hotbot
+    $q = $query['query'];    // lycos, netscape, clusty, hotbot
   elseif(preg_match("#a9\.com#i",$url['host'])) // a9
-    return urldecode(ltrim($url['path'],'/'));
+    $q = urldecode(ltrim($url['path'],'/'));
 
-  return '';
+  if(!$q) return '';
+  $q = join('|',preg_split('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$q,-1,PREG_SPLIT_NO_EMPTY));
+  return $q;
 }
 
 /**