Ad Widget

Collapse

Preprocessing regex matches only first match and then stops - please help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Raimond56
    Junior Member
    • Nov 2021
    • 7

    #1

    Preprocessing regex matches only first match and then stops - please help

    Hello,

    I am having trouble with regex preprocessing only matching one time and then stops matching. Seems like zabbix is not using /g modifer for regex
    How to solve this issue.

    Zabbix version: 5.0

    Below example is what I mean
    Let say we have regex: (?=.*[0-9])(.*)(?<=is)

    We are matching against:

    1 one line is here
    2 second line is here
    3 third line is here
    4 fourth line is here
    5 so on is here
    6 possibly is more here
    This matches everything until "is" on each line. Here is regex101 link also: https://regex101.com/r/NicKyj/1
    So group 1 should be all those matches.

    But in zabbix when I test in preprocessing it will only match the first line. See the image:
    Click image for larger version

Name:	zabbixregex.png
Views:	885
Size:	20.6 KB
ID:	435695


    Is it possible in zabbix to return results from each line in this case in preprocessing ?

    Best regards,
    Raimond

  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4841

    #2
    Yes, it returns only one match. 1 item, 1 value....:P What would be the usecase of returning multiple?
    If you need data manipulation, use javascript. Or your source should return already prepared data, so no manipulations are needed.

    Comment

    • Raimond56
      Junior Member
      • Nov 2021
      • 7

      #3
      Thanks for quick answer!
      Yes the usecase would be to manipulate data - to remove few constantly changing values and as next step in preprocessing use discard unchanged against the remaining data.

      But then it is clear, must learn and create a small javascript most likely.

      Thank you!

      Comment

      Working...