title: Javascript Regexp and "string literal"
body: <p>I'm making a JS "command line" emulator.</p>
  
  <p>I have Regexp: <code>/([^\s"]+)|"([^\s"]+)"/g</code>.
  I want to match single words, like <code>echo</code>, <code>wyświetl</code>, <code>jd923h90asd8</code>. Also, I want to match "string literals" - something like <code>"this is a string"</code> or <code>"f82h3 23fhn aj293 dgja3 xcn32"</code>.</p>
  
  <p>I'm using <code>match</code> method on input string to get array of all matches. But problem is:
  when Regexp matches "string literal" and returns string to array, this string INCLUDES double-quotes. I don't want double-quotes, but the question is - why Regexp includes double-quotes? In the Regexp, quotes <code>""</code> are excluded from <code>()</code> group. Why Regexp includes it all?</p>
  
  <p>EDIT:</p>
  
  <pre><code>var re = /([^\s"]+)|"([^\s"]+)"/g;
  
  var process = function (text) {
      return execute(text.match(re));
  }
  
  var execute = function (arr) {
      console.log(arr);
      try {
          //... apply a function with arguments...
      } catch (e) {
          error(arr[0]+": wrong function");
          return "";
      }
  }
  </code></pre>
  
  <p>For input <code>echo abc "abc def" "ghi"</code> Regexp returns array <code>["echo", "abc", "abc", "def", ""ghi""]</code>. 
  I want to make a Regexp, that from that input will return <code>["echo", "abc", "abc def", "ghi"]</code>.</p>