I need to find and replace a list of words given by the user. My application reads line by line in an HTML file and I want to verify if there is a word from the list and replace it with a blank space. This is what I have until now but I think I will have to modify my hole code in order to get what I want.
    private static void PrintFile(File source) throws IOException {
    String s;
    FileReader fr = new FileReader(source);
    @SuppressWarnings("resource")
    BufferedReader br = new BufferedReader(fr);
    @SuppressWarnings("resource")
    PrintWriter pw = new PrintWriter("Results.txt");
    while ((s=br.readLine())!=null) {
        pw.println(s.replaceAll(" ", "") //Words to be replaced.
                .replaceAll("<br>", "")
                .replaceAll("&", "")
                .replaceAll("</p>", "")
                .replaceAll("</body>","")
                .replaceAll("</html>", "")
                .replaceAll("<remote object=\"#DEFAULT\">>", ""));
    }
    System.out.println("Done!");
}
I accept any suggestions, the list idea may not be the best option.
 
     
     
    