import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String args[]) { Pattern p = Pattern.compile("test"); Matcher matcher = p.matcher("this is a test"); // display the output for the candidate System.out.println(matcher.lookingAt()); } }