title: Regex exec only returning first match
body: <p>I am trying to implement the following regex search found on <a href="http://www.golfscript.com/golfscript/syntax.html" rel="noreferrer">golfscript syntax page</a>.</p>
  
  <pre><code>var ptrn = /[a-zA-Z_][a-zA-Z0-9_]*|'(?:\\.|[^'])*'?|"(?:\\.|[^"])*"?|-?[0-9]+|#[^\n\r]*|./mg;
  input = ptrn.exec(input);
  </code></pre>
  
  <p>Input is only ever the first match of the regexp. for example:
  <code>"hello" "world"</code> should return <code>["hello", "world"]</code> but it only returns <code>["hello"]</code>.</p>