Alright I have these strings

String domain1 = ". com";
String domain2 = ". edu";
String domain3 = ". org";

I want to make sure that when the user puts in their username (their email) that the domain will be the last four characters. How do I get this to happen? Thank you

if (s.matches("\\.(com|edu|org)$")) {...} else {...}