title: How to read a paragraph from a file in java
body: <p>I have been given a file which has many paragraphs in it. The output I am expecting is that I read one paragraph at a time and perform operations on it.</p>
  
  <pre><code>final String PARAGRAPH_SPLIT_REGEX = "(?m)(?=^\\s{4})";
  
          String currentLine;
  
          final BufferedReader bf = new BufferedReader(new FileReader("filename"));
  
  
              currentLine = bf.readLine();
  
              final StringBuilder stringBuilder = new StringBuilder();
              while(currentLine !=null) {
  
                  stringBuilder.append(currentLine);
                  stringBuilder.append(System.lineSeparator());
                  currentLine = bf.readLine();
              }
  
              String[] paragraph= new String[stringBuilder.length()];
  
              if(stringBuilder!=null) {
  
                  final String value = stringBuilder.toString();
                  paragraph = value.split(PARAGRAPH_SPLIT_REGEX);
              }
  
              for (final String s : paragraph) {
  
                  System.out.println(s);
              }
  </code></pre>
  
  <p>File (Every paragraph has a space of 2 characters before it, and there is no blank line between paragraphs):</p>
  
  <blockquote>
    <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Story</p>
    
    <p>&nbsp;&nbsp;Her companions instrument set estimating sex remarkably solicitude
    motionless. Property men the why smallest graceful day insisted
    required. Inquiry justice country old placing sitting any ten age.
    Looking venture justice in evident in totally he do ability. Be is
    lose girl long of up give.<br>
    &nbsp;&nbsp;"Trifling wondered unpacked ye at he. In household certainty an on
    tolerably smallness difficult. Many no each like up be is next neat.
    Put not enjoyment behaviour her supposing. At he pulled object
    others."<br>
    &nbsp;&nbsp;Passage its ten led hearted removal cordial. Preference any astonished
    unreserved mrs. Prosperous understood middletons in conviction an
    uncommonly do. Supposing so be resolving breakfast am or perfectly. Is
    drew am hill from mr. Valley by oh twenty direct me so.<br>
    &nbsp;&nbsp;Departure defective arranging rapturous did believing him all had
    supported. Family months lasted simple set nature vulgar him. 
    &nbsp;&nbsp;"Picture for attempt joy excited ten carried manners talking how.
    Suspicion neglected he resolving agreement perceived at an."</p>
  </blockquote>
  
  <p>However, I am not achieving the desired output. The paragraph variable contains only two values</p>
  
  <ol>
  <li>The title of the file</li>
  <li>The rest of the contents of the file.</li>
  </ol>
  
  <p>I guess, the regex I am trying to use here is not working.
  The regex I gathered from here.
  <a href="https://stackoverflow.com/questions/26367015/splitting-text-into-paragraphs-with-regex-java">Splitting text into paragraphs with regex JAVA</a></p>
  
  <p>I am using java8.</p>