import java.util.regex.*; public class Regexp { public static void main(String []args) { String input = "I allocated room \nfor \t my cat"; Pattern p = Pattern.compile("[A-Za-z&&[^lmt]]"); Matcher m = p.matcher(input); while(m.find()) { System.out.println("Found: "+input.substring(m.start(), m.end()) ); } } }