CRM-18803 - CiviReports REGEXP incorrectly filters selected values
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 1 Jul 2016 05:50:12 +0000 (11:20 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Fri, 1 Jul 2016 05:50:12 +0000 (11:20 +0530)
CRM/Report/Form.php

index e3f7c7857f2171fc24ef1780e76147afbfa4db69..0331ddc3ff89b1bc7a05745de9413b99ce8d7856 100644 (file)
@@ -1883,7 +1883,7 @@ class CRM_Report_Form extends CRM_Core_Form {
         if ($value !== NULL && count($value) > 0) {
           $value = CRM_Utils_Type::escapeAll($value, $type);
           $operator = $op == 'mnot' ? 'NOT' : '';
-          $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', (array) $value) . "[[:cntrl:]]*";
+          $regexp = "([[:cntrl:]]|^)" . implode('([[:cntrl:]]|$)|([[:cntrl:]]|^)', (array) $value) . "([[:cntrl:]]|$)";
           $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'";
         }
         break;