Zabbix Documentation 3.4

3.04.04.4 (current)| In development:5.0 (devel)| Unsupported:1.82.02.22.43.23.44.2Guidelines

User Tools

Site Tools


manual:regular_expressions

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
manual:regular_expressions [2017/11/22 13:56]
natalja.cernohajeva
manual:regular_expressions [2019/04/25 07:48] (current)
martins-v it's possible to run out of stack when using regular expressions
Line 13: Line 13:
  
 You may manually enter a regular expression in supported places. Note that the expression may not start with @ because that symbol is used in Zabbix for referencing global regular expressions. You may manually enter a regular expression in supported places. Note that the expression may not start with @ because that symbol is used in Zabbix for referencing global regular expressions.
 +
 +<note warning>​It'​s possible to run out of stack when using regular expressions. See the [[http://​pcre.org/​original/​doc/​html/​pcrestack.html|pcrestack man page]] for more information.</​note>​
  
 === Global regular expressions === === Global regular expressions ===
Line 33: Line 35:
 |//Name// ||Set the regular expression name. Any Unicode characters are allowed. ​ | |//Name// ||Set the regular expression name. Any Unicode characters are allowed. ​ |
 |//​Expressions// ​ ||Click on //Add// in the Expressions block to add a new subexpression. ​ | |//​Expressions// ​ ||Click on //Add// in the Expressions block to add a new subexpression. ​ |
-^   ​|//​Expression type// ​ |Select expression type:\\ **Character string included** - match the substring\\ **Any character string included** - match any substring from a comma-delimited list\\ **Character string not included** - match any string except the substring\\ **Result is TRUE** - match the regular expression\\ **Result is FALSE** - do not match the regular expression ​ |+^   ​|//​Expression type// ​ |Select expression type:\\ **Character string included** - match the substring\\ **Any character string included** - match any substring from a delimited list. The delimited list includes a comma (,), a dot (.) or a forward slash (/).\\ **Character string not included** - match any string except the substring\\ **Result is TRUE** - match the regular expression\\ **Result is FALSE** - do not match the regular expression ​ |
 ^:::​|//​Expression// ​ |Enter substring/​regular expression. ​ | ^:::​|//​Expression// ​ |Enter substring/​regular expression. ​ |
 +|//​Delimiter//​ ||A comma (,), a dot (.) or a forward slash (/) to separate text strings in a regular expression. This parameter is active only when "//Any character string included//"​ expression type is selected. ​   |
 +|//Case sensitive// ||A checkbox to specify whether a regular expression is sensitive to capitalization of letters. ​ |
  
 Since Zabbix 2.4.0, a forward slash (/) in the expression is treated literally, rather than a delimiter. This way it is possible to save expressions containing a slash, whereas previously it would produce an error. Since Zabbix 2.4.0, a forward slash (/) in the expression is treated literally, rather than a delimiter. This way it is possible to save expressions containing a slash, whereas previously it would produce an error.
Line 45: Line 49:
  
   ^TESTDATABASE$   ^TESTDATABASE$
- 
-Chosen Expression type: "​Result is FALSE"​. Doesn'​t match name, containing string "//​TESTDATABASE//"​. 
  
 {{:​manual:​regular_expressions:​regexp_expr_2.png}} {{:​manual:​regular_expressions:​regexp_expr_2.png}}
 +
 +Chosen //​Expression type//: %%"​Result is FALSE"​%%. Doesn'​t match name, containing string "//​TESTDATABASE//"​.
 +
 +=== Example with an inline regex modifier ===
 +
 +Use of the following regular expression including an inline modifier (?i) to match the characters "​error":​
 +
 +  (?i)error
 +
 +{{:​manual:​regular_expressions:​regexp_expr_3a.png}}  ​
 +
 +Chosen //​Expression type//: %%"​Result is TRUE"​%%. Characters "​error"​ are matched. ​
 +
 +=== Another example with an inline regex modifier ===
 +
 +Use of the following regular expression including multiple inline modifiers to match the characters after a specific line:
 +  (?<​=match (?​i)everything(?​-i) after this line\n)(?​sx).*#​ we add s modifier to allow . match newline characters
 +
 +{{:​manual:​regular_expressions:​regexp_expr_4_new.png}}
 +
 +Chosen Expression type: %%"​Result is TRUE"​%%. Characters after a specific line are matched. ​
 +
 +<note important>​ **g** modifier can't be specified in line. The list of available modifiers can be found in [[https://​www.pcre.org/​original/​doc/​html/​pcresyntax.html#​SEC16|pcresyntax man page]]. For more information about PCRE syntax please refer to [[https://​www.pcre.org/​original/​doc/​html/​pcrepattern.html|PCRE HTML documentation]]. ​ </​note>​
  
 === More complex example === === More complex example ===
Line 118: Line 143:
 ^Icon mapping^^^^^ ^Icon mapping^^^^^
 | ||Yes|Yes|//​Expression//​ field| | ||Yes|Yes|//​Expression//​ field|
 +| |||||
 +^Item value preprocessing^^^^^
 +| ||Yes|No|**pattern** parameter|
 | ||||| | |||||