title: BufferedReader - Search for string inside .txt file
body: <p>I am trying, using a BufferedReader to count the appearances of a string inside a .txt file. I am using:</p>
  
  <pre><code>File file = new File(path);
  try {
    BufferedReader br = new BufferedReader(new FileReader(file));
    String line;
    int appearances = 0;
    while ((line = br.readLine()) != null) {
        if (line.contains("Hello")) {
           appearances++;
        }
    }
  } catch (FileNotFoundException e) {
      e.printStackTrace();
  } catch (IOException e) {
      e.printStackTrace();
  }
  System.out.println("Found " + appearances);
  </code></pre>
  
  <p>But the problem is that if my .txt file contains for example the string <code>"Hello, world\nHello, Hello, world!"</code> and <code>"Hello"</code> is to be found then the appearances become two instead of three because it searches a line for only one appearance of the string. How could I fix this? Thanks a lot</p>