5 Replies Latest reply on Jan 10, 2018 11:52 AM by njoylif

    Dynamic Query (REGEX) help

    johnny ringo

      Hello All,

       

      I have recently discovered the dynamic query feature (with regular expression support) in NPM and I would like to use it to group devices and applications on my network.  I have been trying to create a simple dynamic query based on IP Address but something in my syntax is incorrect because it is returning no results.  Can someone assist?  Myself and my colleague (who uses REGEX extensively) are not sure why this is not working.  I am just trying to create a simple group for all devices in a class C subnet.  I am using the Orion Object "Node" and "IP Address", and the condition is "contains".  Here is my REGEX expression:

       

       

      OCTETA.OCTETB.OCTETC.[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]

       

      It seems to me that SolarWinds is not recognizing the "|" symbol because when I just use the brackets to identify character classes it will catch the correct nodes.  But I could be wrong.

      Thanks!

      jc

        • Re: Dynamic Query (REGEX) help
          jan

          Hi jrchapman,

           

          can you try this: OCTETA.OCTETB.OCTETC.([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])

          without the ( ) it means "OCTETA.OCTETB.OCTETC.[0-9]" or "[1-9][0-9]" or "1[0-9][0-9]" or "2[0-4][0-9]|25[0-5]"

           

          Let us know if that helps.

           

          Jan

            • Re: Dynamic Query (REGEX) help
              johnny ringo

              Hi Jan,

              thanks for the reply.  That doesn't work either.  Are you sure the UI recognizes the "|" symbol?  If I just use brackets I will catch nodes with IP addresses that meet the character class criteria.  I can't create criteria that will match all addresses in a Class C subnet.

               

              Any other ideas?

               

              thanks

              jrchapman

                • Re: Dynamic Query (REGEX) help
                  jan

                  Hi,

                   

                  sorry for misleading information in my previous post - that applies only for regexes.

                  In dynamic groups, we do not support regex, only what SQL supports in the LIKE operator (see LIKE (Transact-SQL))

                  That's why the brackets [ ] worked but not parentheses.

                  You can also use "*" instead of "%" and "?" instead of "_"

                   

                  If this is about IP address field which can contain only valid IP, you should be fine with OCTETA.OCTETB.OCTETC.* when filtering a class C subnet.

                  If you would like to have more specific condition, you need to create multiple dynamic queries in a single group, each filtering one part of your condition (where you would use "|" symbol)

                   

                  Hope this helps

                  Jan

              • Re: Dynamic Query (REGEX) help
                johnny ringo

                Hi Jan,

                Thanks.  This explains alot.  This should give me enough to go on to build the queries I need.

                 

                FYI, I found that in my case some of the symbols worked the opposite as you described.  "*", and "?" did not work, but "_" and "%" did return the expected result.

                 

                thanks again,

                jc

                1 of 1 people found this helpful
                • Re: Dynamic Query (REGEX) help
                  njoylif

                  Submitted Feature Request for "NOT CONTAINS" if interested:

                  FR - NPM GROUP DYNAMIC QUERY - CREATE OR ALLOW "NOT CONTAINS"