title: How to slice optional arguments in RegEx?
body: <p>Actually i have the following RegExp expression:</p>
  
  <p><code>/^(?:(?:\,([A-Za-z]{5}))?)+$/g</code></p>
  
  <p>So the accepted input should be something like ,IGORA but even ,IGORA,GIANC,LOLLI is valid and i would be able to slice the string to 3 group  in this case, in other the group number should be equals to the user input that pass the RegExp test.</p>
  
  <p>i was trying to do something like this in JavaScript but it return only the last value</p>
  
  <pre><code> var str = ',GIANC,IGORA';
        var arr = str.match(/^(?:(?:\,([A-Za-z]{5}))?)+$/).slice(1);
        alert(arr);
  </code></pre>
  
  <p>So the output is 'IGORA' while i would it to be 'GIANC' 'IGORA'</p>
  
  <p>Here is another example</p>
  
  <pre><code>/^([A-Z]{5})(?:(?:\,([A-Za-z]{2}))?)+$/g
  </code></pre>
  
  <p>test of regexp may have at least 5 chart string but it also can have other 5 chart string separated with a comma so from input</p>
  
  <p>IGORA,CIAOA,POPOP</p>
  
  <p>I would have an array of <code>["IGORA","CIAOA","POPOP"]</code></p>