title: How can I split a String by all whitespace or commas
body: <pre><code>Dim nSet As String() = "1   3, 5,6".Split(",| ")
  </code></pre>
  
  <p>The array would then be:</p>
  
  <pre class="lang-none prettyprint-override"><code>1   3
  5
  6
  </code></pre>
  
  <hr>
  
  <p>I looked at <a href="https://stackoverflow.com/questions/3654446/java-regex-help-splitting-string-on-spaces-and-commas">this example</a> and tried to implement that regex:</p>
  
  <pre><code>Dim nSet As String() = "1   3, 5,6".Split("\\s*(,|\\s)\\s*")
  </code></pre>
  
  <p>But the array was just:</p>
  
  <pre class="lang-none prettyprint-override"><code>1   3, 5,6
  </code></pre>
  
  <hr>
  
  <h3>Expected Output</h3>
  
  <p>I just need an array where each element has a single number, <strong>or</strong> a single number and any amount of whitespace (because then I can use <code>.Trim</code> on the element). </p>
  
  <p>I want to be able to get the array to be:</p>
  
  <pre class="lang-none prettyprint-override"><code>1
  3
  5
  6
  </code></pre>
  
  <p>I'm using Microsoft Visual Basic Studio 2010 Express. I'm not sure what language it specifically uses, but it's different than the C languages in ways.</p>