Regex for extracting tablename from SQL
Posted: Wed May 24, 2006 6:11 pm
Hey All you RegEx Pros 
Well I am developing a SQL-error fix-er (detects errors then attempts to parse install.sql if table is not found or column is missing) and I need a way to get all the tables in the FROM section of a MySQL query
Well, I am not great with Regex (I can match simple strings) but basically I need the PREG regex for this psuedo query:
SELECT data FROM nuke_users WHERE id= '1'
I need everything listed in the FROM section (so if they were listed like nuke_users, nuke_bbposts, etc then I'd use explode() to get the into an array)
Thanks!
Well I am developing a SQL-error fix-er (detects errors then attempts to parse install.sql if table is not found or column is missing) and I need a way to get all the tables in the FROM section of a MySQL query
Well, I am not great with Regex (I can match simple strings) but basically I need the PREG regex for this psuedo query:
SELECT data FROM nuke_users WHERE id= '1'
I need everything listed in the FROM section (so if they were listed like nuke_users, nuke_bbposts, etc then I'd use explode() to get the into an array)
Thanks!