title: Use Javascript RegEx to extract column names from SQLite Create Table SQL
body: <p>I'm trying to extract column names from a SQLite result set from sqlite_master's sql column. I get hosed up in the regular expressions in the match() and split() functions.</p>
  
  <pre><code>t1.executeSql('SELECT name, sql FROM sqlite_master WHERE type="table" and name!="__WebKitDatabaseInfoTable__";', [],
    function(t1, result) {
     for(i = 0;i &lt; result.rows.length; i++){
       var tbl = result.rows.item(i).name;
       var dbSchema = result.rows.item(i).sql;
  // errors out on next line
       var columns = dbSchema.match(/.*CREATE\s+TABLE\s+(\S+)\s+\((.*)\).*/)[2].split(/\s+[^,]+,?\s*/);
     }
    },
    function(){console.log('err1');}
  );
  </code></pre>
  
  <p>I want to parse SQL statements like these...</p>
  
  <pre><code>CREATE TABLE sqlite_sequence(name,seq);
  CREATE TABLE tblConfig (Key TEXT NOT NULL,Value TEXT NOT NULL);
  CREATE TABLE tblIcon (IconID INTEGER NOT NULL PRIMARY KEY,png TEXT NOT NULL,img32 TEXT NOT NULL,img64 TEXT NOT NULL,Version TEXT NOT NULL)
  </code></pre>
  
  <p>into a strings like theses...</p>
  
  <pre><code>name,seq
  Key,Value
  IconID,png,img32,img64,Version
  </code></pre>
  
  <p>Any help with a RegEx would be greatly appreciated.</p>