title: Remove empty line from a multi-line string with Java
body: <p>I have a multi-line string and some empty lines between other lines. It looks like:</p>
  
  <pre><code>def msg = """
                  AAAAAA
  
                  BBBBBB
  
  
                  CCCCCC
  
                  DDDDDD
  
  
  
  
  
  
  
                  EEEEEE
                  TEST
                  FFFFF
  
  
                  GGGGGG
  """
  </code></pre>
  
  <p>I tried some regex expression with :</p>
  
  <pre><code>msg = msg.replaceAll('(\n\\\\s+\n)+', '')
  </code></pre>
  
  <p>Or </p>
  
  <pre><code>msg = msg.replaceAll('(\r?\n){2,}', '$1');
  </code></pre>
  
  <p>But nothing is good about what I'm looking...</p>
  
  <p>Is it possible to remove only empty lines? to get something like that :</p>
  
  <pre><code>def msg = """
                      AAAAAA
                      BBBBBB
                      CCCCCC
                      DDDDDD
                      EEEEEE
                      TEST
                      FFFFF
                      GGGGGG
  
  """
  </code></pre>