title: Separate string by whitespace, but keep newlines in split array
body: <p>I'm trying to split a string in Java, but keep the newline characters <em>as elements in the array</em>.</p>
  
  <p>For example, with input: <code>"Hello \n\n\nworld!"</code></p>
  
  <p>I want the output to be: <code>["Hello", "\n", "\n", "\n", "world", "!"]</code></p>
  
  <p>The regex I have in place right now is this:<br>
  <code>String[] parsed = input.split(" +|(?=\\p{Punct})|(?&lt;=\\p{Punct})");</code></p>
  
  <p>This gets me the punctuation separation I want, but its output looks like this:<br><code>["Hello", "\n\n\nworld", "!"]</code></p>
  
  <p>Is there a way to unclump the newlines in Java?</p>