Matches Regex Value

user-OHTrLNQCsZ
New Contributor III

Hi

Can someone help me with the value required for "matches regex" for an application version less than 2.13.210200

thanks

7 REPLIES 7

mschroder
Valued Contributor

post deleted since not correct.

sdagley
Esteemed Contributor II

@user-OHTrLNQCsZ Take a look at https://github.com/moorereason/make_ge_version_regex/. It will create a regex that will match a specified version number or higher, and if you use "does not match regex" as the operator in your Smart Group it will match applications versions less than the specified version number.

skeenan07
New Contributor III

This Match Version Number of Higher.bash script from William Smith generates a regex for the version you specify or higher. The script generated the following regex:

^(d{2,}.*|[3-9].*|2.d{3,}.*|2.[2-9]d{1,}.*|2.1[4-9].*|2.13.d{7,}.*|2.13.[3-9]d{5,}.*|2.13.2[2-9]d{4,}.*|2.13.21[1-9]d{3,}.*|2.13.210[3-9]d{2,}.*|2.13.2102[1-9]d{1,}.*|2.13.21020[1-9].*|2.13.210200.*)$

In your group or search, you can set the value to does not match that regex.

Edit: I did not see @sdagley's post until after I posted this.

sdagley
Esteemed Contributor II

@skeenan07 Great minds and all that :-) @hsucmoore created the make_ge_version_regexp.sh variant of William Smith's script in response to the Allow regex longer than 255 characters in Smart Group criteria Feature Request.

user-OHTrLNQCsZ
New Contributor III

Thanks alot everyone I will give it a try.

user-OHTrLNQCsZ
New Contributor III

@skeenan07 Well it "works"

The Smart Group also looks for the name of an .app (so is name of app) and does not match regex (as above) .

But when exporting to Excel it shows a multitude of different application names. Any thoughts?

donmontalvo
Esteemed Contributor III

So many ways to skin the cat. My brain has an easier time when I first define the "desired state" version (2.13.210200), and create the regex in a way that covers that version and higher. This way I can use "Does not match regex", where the regex covers the desired state and higher.

I use https://regex101.com to create the regex and test. Since regex analyzes a string, there's no need to check the entire version, just go from left to right, and stop when you've confirmed the portion of the string meets the requirements.

^(2\.13\.210[2-9]|2\.13\.21[1-9]|2\.13\.2[2-9]|2\.13\.[3-9]|2\.1[4-9]|2\.[2-9]|[3-9])

--
https://donmontalvo.com