I want to find a string in 3 types of inputs :

1. Client XXX.MYDOMAIN.COM is
2. Client YYY is
3. Client ZZZ.mydomain.com is

What I want is : 

1. XXX
2. YYY
3. ZZZ

Can someone help me with this.
Thank you.