Ad Widget

Collapse

Preprocessing problem with REGEX

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JulianC
    Junior Member
    • Feb 2024
    • 4

    #1

    Preprocessing problem with REGEX

    Hi all,

    I try to do some preprocessing to group a date and monitor that. However I can't output the value instead it only outputs /1

    XML:

    <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>
    <root>
    <device id="331" man="Mikronika" devID="12345" mod="type-C-v2" lang="PL" devType="type-C-v2" oem=" " fwv="100" swv=" " hwv="0" addressIP="127.0.0.1" patched="Yes" debstatus="-" configversion="202.202.202|2023-01-26 15:48:55" description="station" status="1" changes="WaitingForConnect;2023/01/26 15:48:47.246;Net;Accepted;2023/01/26 15:50:17.461;DMServer;"lastcontactdate="2023-05-12 12:40:34" station="" cfg_status=" " headend="Test_001" casdu="-1" state="2" isNewestConf="1">
    <groups />
    </device>

    I used the regex: lastcontactdate="([^"]+)" and if I look via regex101.com it should capture the date.

    In zabbix preprocessing I have the following name: regular expression paramater: lastcontactdate="([^"]+)" output: /1

    The current result I get is /1, however not the value from the xml text
  • ISiroshtan
    Senior Member
    • Nov 2019
    • 324

    #2
    Hey there
    The capture group functionality actually requires you to use backslash not the forward slash. So \1, not the /1

    Comment

    Working...