//Sample18_22.java class Sample18_22{ public static void main(String[] args){ String regex = "a*bcdefg"; System.out.println(regex); System.out.println("----------"); String[] strs = { "bcdefg", "abcdefg", "aabcdefg", "aaabcdefg", "ababcdefg" }; boolean boo; for(String str : strs){ boo = str.matches(regex); System.out.println(str + "\t" + boo); } } }