title: How to use regex to split a string by comma or linebreak in javascript?
body: <p>I have a React application where I need to split user input (string) by either comma or linebreak to later map them out as a list. Each one work individually, but when I have 2 different examples on the page only one of them work and the other one is read as one string.
  Input can look like:</p>
  <p><code>one, two, three</code></p>
  <p>or like:</p>
  <pre><code>one 
  two  
  three
  </code></pre>
  <p>I've tried:</p>
  <pre><code>const foo = ((',') || (/[\r\n]+/)); 
  
  .split(foo)
  </code></pre>
  <p>But only one of them works then.</p>
  <p><code>.split(',')</code> works and <code>.split('\n')</code> also works (as well as more complex regex like <code>(/[\r\n]+/)</code> .</p>
  <p>How do I add that it should be either comma or linebreak (for both windows and unix) to split on?</p>
  <p>Help much appreciated!</p>