### Eclipse Workspace Patch 1.0
#P zabbix-2.2.2
Index: src/libs/zbxserver/evalfunc.c
===================================================================
--- src/libs/zbxserver/evalfunc.c	(revision 43296)
+++ src/libs/zbxserver/evalfunc.c	(working copy)
@@ -317,7 +317,8 @@
 #define OP_LE	5
 #define OP_LIKE	6
 #define OP_BAND	7
-#define OP_MAX	8
+#define OP_REGEXP	8
+#define OP_MAX	9
 
 static int	evaluate_COUNT_one(unsigned char value_type, int op, history_value_t *value, const char *arg2,
 		const char *arg2_2)
@@ -427,6 +428,10 @@
 					if (NULL != strstr(value->log->value, arg2))
 						return SUCCEED;
 					break;
+				case OP_REGEXP:
+					if (NULL != zbx_regexp_match(value->log->value, arg2, NULL))
+						return SUCCEED;
+					break;
 			}
 
 			break;
@@ -445,6 +450,10 @@
 					if (NULL != strstr(value->str, arg2))
 						return SUCCEED;
 					break;
+				case OP_REGEXP:
+					if (NULL != zbx_regexp_match(value->log->value, arg2, NULL))
+						return SUCCEED;
+					break;
 			}
 	}
 
@@ -519,6 +528,8 @@
 			op = OP_LE;
 		else if (0 == strcmp(arg3, "like"))
 			op = OP_LIKE;
+		else if (0 == strcmp(arg3, "regexp"))
+			op = OP_REGEXP;
 		else if (0 == strcmp(arg3, "band"))
 		{
 			op = OP_BAND;
@@ -534,9 +545,9 @@
 
 		if (1 == fail)
 			zabbix_log(LOG_LEVEL_DEBUG, "operator \"%s\" is not supported for function COUNT", arg3);
-		else if (0 != numeric_search && OP_LIKE == op)
+		else if (0 != numeric_search && ( OP_LIKE == op || OP_REGEXP == op ))
 			zabbix_log(LOG_LEVEL_DEBUG, "operator \"like\" is not supported for counting numeric values");
-		else if (0 == numeric_search && OP_LIKE != op && OP_EQ != op && OP_NE != op)
+		else if (0 == numeric_search && OP_LIKE != op && OP_REGEXP != op && OP_EQ != op && OP_NE != op)
 			zabbix_log(LOG_LEVEL_DEBUG, "operator \"%s\" is not supported for counting textual values", arg3);
 		else
 			fail = 0;
@@ -603,6 +614,7 @@
 #undef OP_LE
 #undef OP_LIKE
 #undef OP_BAND
+#undef OP_REGEXP
 #undef OP_MAX
 
 /******************************************************************************
Index: frontends/php/include/classes/validators/CTriggerFunctionValidator.php
===================================================================
--- frontends/php/include/classes/validators/CTriggerFunctionValidator.php	(revision 43296)
+++ frontends/php/include/classes/validators/CTriggerFunctionValidator.php	(working copy)
@@ -385,7 +385,7 @@
 	}
 
 	/**
-	 * Validate trigger function parameter which can contain operation (band, eq, ge, gt, le, like, lt, ne) or
+	 * Validate trigger function parameter which can contain operation (band, eq, ge, gt, le, like, lt, ne, regexp) or
 	 * an empty value.
 	 *
 	 * @param string $param
@@ -393,6 +393,6 @@
 	 * @return bool
 	 */
 	private function validateOperation($param) {
-		return preg_match('/^(eq|ne|gt|ge|lt|le|like|band|)$/', $param);
+		return preg_match('/^(eq|ne|gt|ge|lt|le|like|band|regexp|)$/', $param);
 	}
 }
