import java.io.*;import java.util.*;import java.util.regex.*;public class PatternApp { public static void main (String[] args) throws IOException { FileReader fin = new FileReader("src/word.rtf"); Scanner wordIn = new Scanner(fin); Pattern emailPattern = Pattern.compile("\\b[A-z0-9._%+-]+@[A-z0-9.-]+\\.[A-z]{2,4}\\b"); String word; System.out.println("The words as read in"); while(wordIn.hasNext()) { word = wordIn.next(); Matcher m = emailPattern.matcher(word); if(m.find()) System.out.println(m.group()); } }}