2 Replies Latest reply on Oct 23, 2013 8:24 PM by njoylif

    Regular Expressions for Dynamic Query on NPM


      I am creating dynamic queries on NPM for sites to fall in their respective groups. I would like to know correct expression to include these subnet's in the queries.


      So let’s consider that I have a site with /27 subnet, which will have a valid rage between

      What kind of expression will match the range of  IP’s in the query given below.


      We have used similar expression “ 10.10.[0-3].* ” for matching the 3 octet of the subnet but it only matches " 10.10.0.X "

      Similarly when I am matching the last octet  ex : 10.10.10.[10-20]


      So the match case only matches the first digit inside the bracket and skips the rest


      Dynamic query.png

        • Re: Regular Expressions for Dynamic Query on NPM

          So here is the deal !

          I spoke with support tech they told me that they don't fully support regular expression.

          What I figured out is that when we enter regular expression while building dynamic queries, Orion considers numbers in an IP as characters and will match only one character at a time.


          Let's take couple of range of IP's to work with.

                       IPs                                         Regular Expression                                                                                                                                                                         

          1: - :                      10.30.[0-3].*          


          2: - :                  10.30.4[2-9].*        

          Since it does the charcter matching, we have fixed the first character of the 3rd octet as 4 and the 2nd charcter between 2-9


          3: - :               10.30.15[6-9].*      

          Here first 2 characters in the 3rd octet is fixed.


          Note: This whole logic works as long as there is no reset in the character of the octet that you are matching, the reason for which I will clear in the following example.


          4: -    :              10.30.6[8-9].* & 10.30.7[0-1].*

          In this example since the 1st character of the 3rd Octet is getting reset, you need two separate queries to cover the whole range.


          5: :,[0-9] ,[0-2]

          Here you will need 3 separate queries to split and match the complete range


          I hope that helps,
          Open for suggestions if you have any other alternatives.

          2 of 2 people found this helpful