diff --git a/www/class/centreonUtils.class.php b/www/class/centreonUtils.class.php index 00151e7ed24..fe09ecabf41 100755 --- a/www/class/centreonUtils.class.php +++ b/www/class/centreonUtils.class.php @@ -217,6 +217,12 @@ public static function operandToMysqlFormat($str) case "notlike": $result = "NOT LIKE"; break; + case "regex": + $result = "REGEXP"; + break; + case "notregex": + $result = "NOT REGEXP"; + break; default: $result = ""; break; diff --git a/www/class/centreonWidget/Params/Compare.class.php b/www/class/centreonWidget/Params/Compare.class.php index fc6c51854d7..8674eb98293 100644 --- a/www/class/centreonWidget/Params/Compare.class.php +++ b/www/class/centreonWidget/Params/Compare.class.php @@ -56,7 +56,9 @@ public function init($params) "eq" => "=", "ne" => "!=", "like" => "LIKE", - "notlike" => "NOT LIKE" + "notlike" => "NOT LIKE", + "regex" => "REGEXP", + "notregex"=> "NOT REGEXP" ); $elems[] = $this->quickform->addElement('select', 'op_' . $params['parameter_id'], '', $operands); $elems[] = $this->quickform->addElement( @@ -83,7 +85,7 @@ public function setValue($params) $target = $params['default_value']; } if (isset($target)) { - if (preg_match("/(gt |lt |gte |lte |eq |ne |like |notlike )(.+)/", $target, $matches)) { + if (preg_match("/(gt |lt |gte |lte |eq |ne |like |notlike |regex |notregex )(.+)/", $target, $matches)) { $op = trim($matches[1]); $val = trim($matches[2]); }