code: function consumeToken(regex, string) {
      var result = regex.exec(string);
      if (result) {
        result = regex.ignoreCase ? result[0].toLowerCase() : result[0];
        return [result, string.substr(result.length)];
      }
    }
docs: consume* functions return a 2 value array of [parsed-data, '' or not-yet consumed input] Regex should be anchored with /^