Regex question on single / double digit version numbers

neilpotter
New Contributor II

Hi all,
I'm having trouble getting my head around regex for software versions when moving from a single to double digit format.
For instance earlier this year the current version of some software was 7.0.8 so we used a smart group to match the version number to [0-7].[0.9].[0.7]
The idea being that anyone of version 6.x.x would be updated, and anyone on version 7.0.0 to 7 would be updated.
All was fine but now version 7.0.10 is out, and my current regex is making anyone who has manually updated to 7.0.10 in a loop of re-installing, as the 3rd digit is now a 1, which is captured by the [0-7] bit.

I've seen lots of articles but it's not making sense on how to cover "anything less than 7.0.10" so that if someone installs 7.0.11 manually, they don't get downgraded, but anyone with 7.0.8 is updated.

1 REPLY 1

skeenan07
New Contributor III

This regex [7].[0-9].[1-9][0-9] would match 7.0.10 through 7.9.99. In your smart group, you can set it to does not match that regex, so anything lower than 7.0.10 would be included. However, this regex ([0-6].[0-9].(([1-9][0-9])|([0-9])))|([7].[0].[0-9]$) should match 7.0.9 and lower.

Also, I've found https://regex101.com incredibly useful for testing regex.