Java tutorial
public class Main { public static void main(String[] args) { String str1 = "java2s", str2 = "java2s.com"; boolean retval = str1.matches(str2); System.out.println("Value returned = " + retval); retval = str2.matches("com"); System.out.println("Value returned = " + retval); retval = str1.matches("java"); System.out.println("Value returned = " + retval); } }