2 Replies Latest reply on May 12, 2016 10:43 PM by James Donohue

    Compliance Rule - Regex in Version string

    James Donohue



      I've been given a requirement to check a Version string in the Windows Registry and ensure that the Targets contain 11.0.9600.17501 or Greater. I can't perform any mathematical condition since it is a string and changing it to value only works on 11 and stops at the first dot. So, I'm assuming that I have to perform Regex functionality in the Rule and have only been able to get a basic match to work, as shown:



      This basically just reports that the Rule is compliant because it matches the pattern. I went further, and that's where I got stuck


      I tried this but it didn't work and full disclosure, I'm a Regex novice.

      ^(\11+\.)?(\d+\.)?(\d+\.)?(\*|\d+)$ (<- no good)


      In simple terms, I want to match this:



      and to further that, I'd rather do this (in simple terms):

      11.0.9(600 or greater).*


      As always, any assistance is appreciated!

        • 1. Re: Compliance Rule - Regex in Version string
          James Donohue

          Made some good progress since I just posted. I changed my Google search to 'Regex for beginners' and first site I hit was a tremendous help. I changed my Rule to:


          <value> match ^([11]+\.)?([0]+\.)?([9600]+\.)?([0-9]+)$

          and it worked as expected.


          I'm still not sure how to covert the 3rd portion to read as 9 (600 or greater) though, if anyone has ideas. . .

          • 2. Re: Compliance Rule - Regex in Version string
            James Donohue

            I wound up doing this:



            I don't know if its the most efficient construct but it seems to work, So, my interpretation of the above is any version that is equal to: 11.0.9(600 or greater.<any build number>


            This is compliant:

            "Registry Value:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\svcVersion"."String Value (Windows)" ["11.0.9600.18282"] matches "^([1]+[1]\.)?([0]+\.)?([9]+[6-9]+[0-9]+[0-9]+\.)?([0-9]+)$"


            So, I think I'm good. . . lol