I'm using regex to parse out the version number. For 2019 I'm using this:
^(16.[2-9]d.)|(16.1[7-9].)
That will match 16.17, 16.18, 16.19, and any 2-digit number from 16.20-16.99.
it would be nice to have a 'less than" or "greater than" option in "Application-version". Just like it exists in "Operating System Version"
Office 2016 < 16.17
Office 2019 > 16.16
@LeidenUniv I agree that we should have that capability, and if you do not want to use the regex method above, go vote up the FR to have this added:
Smart computer group application version compare with greater than & less than
However, you'll note that Jamf is reporting this as partially implemented with Patch Reporting. Although I would argue that this does not provide the capability for enough software titles, I shouldn't have to create a Patch Management entry just to compare versions that are stored in the Applications table, and I shouldn't have to stand up an internal patch server to be able to get the other titles in.
I started down the regex path but figured that since MS could change their version scheme whenever - the regex could get pretty complicated quickly. I decided to create an Extension Attribute for this instead.
#!/bin/bash
wordVersion=$(defaults read "/Applications/Microsoft Word.app/Contents/Info.plist" CFBundleShortVersionString)
majorVersion=$(awk -F '.' '{print $1}' <<< "$wordVersion")
minorVersion=$(awk -F '.' '{print $2}' <<< "$wordVersion")
if [[ $majorVersion -ge "15" ]]; then
if [[ "$majorVersion" -ge "16" ]] && [[ "$minorVersion" -ge "17" ]]; then
echo "<result>2019</result>"
else
echo "<result>2016</result>"
fi
else
if [[ -d "/Applications/Microsoft Office 2011/" ]]; then
echo "<result>2011</result>"
else
echo "<result>Not Installed</result>"
fi
fi
exit 0
Then your smart groups would be "Office Version" (if that is what you called the EA) "is 2016" or "is 2019". This could be changed pretty easily too if MS decided to change version schemes again.
While Jamf could try to build in smarts for 'greater than' and 'less than' for version numbers, keep in mind version numbers aren't really numbers. They're strings. Strings might include multiple decimals (there's no such thing as a number with more than one decimal) or non-numeric characters like 'v1' or 'b' for beta.
When dealing with version numbers, using regex as @mjhersh suggested is really the best method.
To help me with regex, I purchased Patterns from the Mac App Store for US$2.99. It lets me paste in a sample of what I need to match and provides a regex guide. I can test my regex in the app and watch it highlight my sample text live. It's a handy little tool.


The https://regex101.com site is a similar online tool and it's free.
Learning a little regex is a good way to make use of read-only Fridays. And it's like solving a puzzle, so it's fun.
How do folk report on licence compliance? I get you can do a smart group but I want to add the licences and report how many we are using etc?
Thanks
@Mjhersh: I just tried to follow the above regex for the office 2013 version 14.X.
^(16.[2-9]d.)|(16.1[7-9].)
But didn't get any result. Can you help me with exact regrex for the office version 14.X