import java.util.regex.*; class Samp06 { public static void main(String[] args){ Pattern p = Pattern.compile("(ab)(cd)(ef)(gh)(ij)(kl)(mn)(op)(qr)(st)(uv)\\11"); Matcher m = p.matcher("abcdefghijklmnopqrstuvuv"); while(m.find()){ System.out.printf("%d:%s:%d:%s\n", m.start(), m.group(), m.start(11), m.group(11)); } } }