diff --git a/Solr_Base_Query.php b/Solr_Base_Query.php
index 6671d5a..aa8083a 100644
--- a/Solr_Base_Query.php
+++ b/Solr_Base_Query.php
@@ -545,7 +545,11 @@ class SolrBaseQuery extends SolrFilterSubQuery implements DrupalSolrQueryInterfa
     }
     else {
       // Validate and set sort parameter
-      $fields = implode('|', array_keys($this->available_sorts));
+      $fields = array_keys($this->available_sorts);
+      foreach ($fields as $key => $field) {
+        $fields[$key] = preg_quote($field);
+      }
+      $fields = implode('|', $fields);
       if (preg_match('/^(?:(' . $fields . ') (asc|desc),?)+$/', $sortstring, $matches)) {
         // We only use the last match.
         $this->solrsort['#name'] = $matches[1];
