With this regular epression you can find the words and anything in between even if the words are longer than the words in the regular expression:
(Mac).*?(ExchangeWebServices).*?
It would find this string:
Mac OS X/10.11.5 whatever text in between (15F34); ExchangeWebServices/6.0 (243);
So, if you write the words without the end (ExchangeWebServ):
(Mac).*?(ExchangeWebServ).*?
It would find both strings:
Mac OS X/10.11.5 whatever text in between (15F34); ExchangeWebServices/6.0 (243);
And:
Mac OS X/10.11.5 whatever text in between (15F34); ExchangeWebServ/6.0 (243);
If you need to match exact words you'll need to use \b
as mentioned in the answers above.