Ad Widget

Collapse

Catch next line at regexp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xristoskon
    Junior Member
    • Feb 2024
    • 8

    #1

    Catch next line at regexp

    I use [\r\n] at regexp to catch next line of necessary text , but it doesnt work , any assist on that ?
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Try with \s instead

    Comment

    • xristoskon
      Junior Member
      • Feb 2024
      • 8

      #3
      Originally posted by cyber
      Try with \s instead
      it doesnt work

      i have the regexp : test1\s.(.*).sec
      and the text

      test1
      test2 sec​

      Comment

      • vijayk
        Senior Member
        • May 2023
        • 305

        #4
        Originally posted by xristoskon

        it doesnt work

        i have the regexp : test1\s.(.*).sec
        and the text

        test1
        test2 sec​
        Try Regex generator to match your need.

        Comment

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

          #5
          Click image for larger version

Name:	image.png
Views:	139
Size:	5.5 KB
ID:	478462
          Click image for larger version

Name:	image.png
Views:	129
Size:	3.2 KB
ID:	478463
          Click image for larger version

Name:	image.png
Views:	131
Size:	18.5 KB
ID:	478464

          I don't understand, what is not working? You do have one extra "." there... after \s​

          Comment

          • Hamardaban
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • May 2019
            • 2713

            #6
            Regular expressions in zabbix are applied to each line independently of the others.
            \s is "any white space character"
            What exactly do you want to get out of your "text"?

            Comment

            • xristoskon
              Junior Member
              • Feb 2024
              • 8

              #7
              Originally posted by Hamardaban
              Regular expressions in zabbix are applied to each line independently of the others.
              \s is "any white space character"
              What exactly do you want to get out of your "text"?
              i want any matching case "test1" to export test2 content :

              function="run_if_needed" (process id=1645484): Related kpi is test1
              function="run_if_needed" completed after [test2] sec

              Comment

              • Hamardaban
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • May 2019
                • 2713

                #8
                Option 1 - You can process your text with JS preprocessing and program any search logic there.

                Option 2 - by preprocessing JS, make one line from the text and then process it through regex.​

                Comment

                • xristoskon
                  Junior Member
                  • Feb 2024
                  • 8

                  #9
                  Originally posted by Hamardaban
                  Option 1 - You can process your text with JS preprocessing and program any search logic there.

                  Option 2 - by preprocessing JS, make one line from the text and then process it through regex.​
                  can you assist me with an example ? please

                  Comment

                  • Hamardaban
                    Senior Member
                    Zabbix Certified SpecialistZabbix Certified Professional
                    • May 2019
                    • 2713

                    #10
                    case2 step 1
                    Click image for larger version

Name:	изображение.png
Views:	139
Size:	2.9 KB
ID:	478497

                    Comment

                    Working...