title: JS RegExp to match none or all
body: <p>I'm trying to create a RegExp that will match a string if there are zero or more "options". For example, I have these three strings that I wish to match:</p>
  
  <pre><code>'user'
  'user/1'
  'user/1/admin'
  </code></pre>
  
  <p>I currently have this:</p>
  
  <pre><code>/^user(?:(?:\/){1}([%a-zA-Z0-9\-\_\s,]+))*$/g
  </code></pre>
  
  <p>This will match them all but it will only return the last matched option. So on the 2nd string, it will remember <code>'1'</code>. On the 3rd, it will remember <code>'admin'</code>. On the 3rd, I'd like it to remember <code>['1', 'admin']</code>.</p>
  
  <p>This would need to be dynamic to allow 1 or unlimited options.</p>
  
  <p>This is so I can define something like <code>user:args</code> and I can then return the args.</p>