title: split string by space and new line in Javascript
body: <p>I am trying to split values in string, for example I have a string:
  </p>
  
  <pre><code>var example = "X Y\nX1 Y1\nX2 Y2"
  </code></pre>
  
  <p>and I want to separate it by spaces and <code>\n</code> so I want to get something like that:
  </p>
  
  <pre><code>var 1 = X
  var 2 = Y
  var 3 = X1
  var 4 = Y1
  </code></pre>
  
  <p>And is it possible to check that after the value <code>X</code> I have an <code>Y</code>? I mean <code>X</code> and <code>Y</code> are Lat and Lon so I need both values.</p>