title: Split the sentences by ',' and remove surrounding spaces
body: <p>I have this code:</p>
  
  <pre><code>var r = /(?:^\s*([^\s]*)\s*)(?:,\s*([^\s]*)\s*){0,}$/
  var s = "   a   ,  b  , c "
  var m = s.match(r)
  m =&gt; ["   a   ,  b  , c ", "a", "c"]
  </code></pre>
  
  <p>Looks like the whole string has been matched, but where has <code>"b"</code> gone? I would rather expect to get:</p>
  
  <pre><code>["   a   ,  b  , c ", "a", "b", "c"]
  </code></pre>
  
  <p>so that I can do <code>m.shift()</code> with a result like <code>s.split(',')</code> but also with whitespaces removed.</p>
  
  <p>Do I have a mistake in the regexp or do I misunderstand <code>String.prototype.match</code>?</p>