Testing global regexps

Let's return to Administration | General, choose Regular expressions in the drop-down, and click on New regular expression. Add three expressions here, as follows:

  • First expression:
    • Expression type: Character string included
    • Expression: A
    • Case sensitive: yes
  • Second expression:
    • Expression type: Result is TRUE
    • Expression: ^[0-9]
  • Third expression:
    • Expression type: Result is FALSE
    • Expression: [0-9]$

This should match a string that contains an uppercase A, starts with a number, and does not end with a number. Now, switch to the Test tab and enter 1A2 in the Test string field; then, click on Test expressions. In the following screenshot of the result area, it shows that a string starting with a number and containing an uppercase A corresponds, but then, the string ends with a number, which we negated. As a result, the final test fails:

Zabbix uses PCRE. In older versions, it was only the frontend using the PCRE and the backend would use the POSIX regular expressions. In Zabbix 4.0, this is no longer the case. https://regex101.com/ is a good site to test your PCRE regular expressions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset