I am not that hot at regular expressions and it has made my little mind melt some what.
I am trying to find all the tables names in a query. So say I have the query:
SELECT one, two, three FROM table1, table2 WHERE X=Y
I would like to pull out "table1, table2" or "table1" and "table2"
But what if there is no where statement. It could be the end of the file, or there could be a group by or an order by etc. I know "most" of the time this will not be an issue but I don't like the idea of coding for "most" situations and knowing I have left a hole that could cause things to go wrong later.
Is this a doable Regex expression? Am I being a Regex pleb?
(P.S. this will be done in C# but presume that doesn't matter much).
See Question&Answers more detail:os