title: RegEx for parsing SQL query in C#
body: <p>I need to write RegEx in C# to parse SQL join query which is given as a string. Can somebody please help me because I'm new at this. Thanks a lot</p>
  
  <p>this is my problem:</p>
  
  <pre><code>string query = @"SELECT table1.column1, table1.column2, table2.coulmn1, table2.column2
                   FROM table1 INNER JOIN table2 ON table1.column5 = table2.column5";
  </code></pre>
  
  <p>what I actually need is to put all important data into separate variables, like this:</p>
  
  <pre><code>string class1 = table1    
  string class2 = table2    
  string joinForeignKey1 = table1.column5    
  string joinForeignKey2 = table2.column5    
  List&lt;string&gt; attributes1 = table1.column1, table1.column2    
  List&lt;string&gt; attributes2 = table2.column1, table2.column2
  </code></pre>
  
  <p>//COMMENT</p>
  
  <p>I realized that I have made a mistake in sql query so there will be an ON clause. </p>
  
  <p>I can force a user to provide me with the correct syntax, so that will be no problem.</p>
  
  <p>The thing I haven't mentioned is that there can be more than one JOIN ON clause (multiple joins).</p>
  
  <p>Thanks a lot and I will appreciative any given help.</p>