Sorry, I guess I wasn't clear in my original post. I need to test for a FQDN vs. just a machine name. So if the variable is appended with ".
domain.com" it's okay. I won't be matching a specific string, so it's more of a "contains" type thing. If it was regexp I'd be writing something like ".*\.domain\.com". If it's an IP address (not a specific one, mind you, just a valid IP) - meaning if I was using regexp I'd do something like (might not compile, but you probably know what I mean) "\d*\.\d*\.\d*\.\d*". If it doesn't match those two situations I'll go with the default - although I like your default statement - I didn't know about that.
I know only_if has been deprecated (and I'm glad!) - all my scripts use "when" now, just not sure how to do a conditional substring search.
Sorry for the confusion.