Hi,
I’m new to BigFix so my little issue can be trivial, however I didn’t find my answer by searching for it here or in documentations. I can’t seem to figure out how to check in a smart way if a string contains any numbers.
I can do this by writing a long relevance, something like
Q: exists “banana-4-smoothy” whose (it contains “0” OR it contains “1” OR it contains “3” OR it contains “4” OR it contains “5” OR it contains “6” OR it contains “7” OR it contains “8” OR it contains “9”)
A: True
But I’m sure there is a much faster, much cleaner approach to this. I would like to use the logic to see if a computer is applicable and if a property contains a certain number or not.
Thanks for having this question and hopefully I’m following the topic rules.
@trn Wow! Thanks! It never crossed my mind to use regular expressions. Now I can use
exists “banana-4-smoothy” whose (it contains (regex “.[0-9].”))
and I get the expected result with a lot cleaner statement.
That leading and trailing period before and after [0-9] means it will only match a case where there is something before and something after the number – for instance this will show false:
@strawgate thanks for adding the valuable information! Is it POSIX Extended Regular Expression Syntax library that I should study to master the regex wisdom for BigFix?