title: String matching
body: <p>I want to get column names from SQL 'CREATE' query. </p>
  
  <p><strong>Query:</strong></p>
  
  <pre><code>CREATE TABLE 'test' (
  'col1' INT( 10 ) NOT NULL ,
  'col2' VARCHAR( 50 ) NOT NULL ,
  'col3' DATE NOT NULL
  ) ENGINE = MYISAM ;
  </code></pre>
  
  <p><strong>Code:</strong>  </p>
  
  <pre><code>preg_match_all("/'(.+)' (\w+)\(? ?(\d*) ?\)?/", $sql, $_matches, PREG_SET_ORDER);
  </code></pre>
  
  <p><strong>Output:</strong></p>
  
  <pre><code>Array ( 
  [0] =&gt; Array ( [0] =&gt; 'col1\' INT( 10 ) [1] =&gt; col1\ [2] =&gt; INT [3] =&gt; 10 ) 
  [1] =&gt; Array ( [0] =&gt; 'col2\' VARCHAR( 50 ) [1] =&gt; col2\ [2] =&gt; VARCHAR [3] =&gt; 50 ) 
  [2] =&gt; Array ( [0] =&gt; 'col3\' DATE [1] =&gt; col3\ [2] =&gt; DATE [3] =&gt; ) 
  ) 
  </code></pre>
  
  <p>But I need simple result like this:</p>
  
  <pre><code>array(
    array('INT( 10 )', 'col1'),
    array('VARCHAR( 50 )', 'col2'),
    array('DATE', 'col3')
  );
  </code></pre>
  
  <p>Every possible solution will be appreciated. Thanks</p>