String s = "abcdefg"String t = "cf";String regex = "["+t+"]";System.out.println(s.replaceAll(regex,""));