title: Newline not being replaced in regex match?
body: <p>I have the following code attempting to parse lines starting with # and replacing each line with a an empty string, however the newline is not getting stripped:</p>
  
  <p>-- input --</p>
  
  <pre><code># Remove this.
  # remove this
  # remove this line
  keep # this line
  keep this # line too
  </code></pre>
  
  <p>-- actual output (the . represents blank line) --</p>
  
  <pre><code>.   
  .
  .
  keep # this line
  keep this # line too
  </code></pre>
  
  <p>-- expected output</p>
  
  <pre><code>keep # this line
  keep this # line too
  </code></pre>
  
  <p>-- code --</p>
  
  <pre><code>    String text = "# Remove this.\n# remove this\n# remove this line\n" +
          "keep # this line\nkeep this # line too";
      System.out.println(text);
      Pattern PATTERN = Pattern.compile("^#(.*)$", Pattern.MULTILINE);
      Matcher m = PATTERN.matcher(text);
      if (m.find()) {
          text = m.replaceAll("").replaceAll("[\n]+$", "");
          System.out.println(text);
      }
  </code></pre>
  
  <p>How can I remove the \n's in the regex match?</p>