import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String args[]) throws Exception {
String regex = "test (?!Test)[A-Z]\\w+";
Pattern pattern = Pattern.compile(regex);
String candidate = "this is a test ";
Matcher matcher = pattern.matcher(candidate);
String tmp = null;
while (matcher.find()) {
tmp = matcher.group();
System.out.println("MATCH:" + tmp);
}
}
}