My goal is to create a Google Analytics filter that "includes only" 2 host names.
For example, include only:
The desired result is that Google Analytics reports display traffic only from www.example.com and www2.example.com.
Is there a way to accomplish this?
Yes you can do this by seperating sources with pipe "|"
example\.com|example2\.com|.*example3\.com
Here is Google documentation:
Include Filters are applied with the reverse logic. When you apply an Include Filter, the hit is thrown away if the pattern does not match the data. If you apply multiple Include Filters, the hit must match every applied Include Filter in order to save the hit. To include multiple patterns for a specific field, create a single include filter that contains all of the individual expressions separated by '|'.
Check these links for more information
https://support.google.com/analytics/answer/1034832?hl=en&ref_topic=1034830