Lets assume I have the following string: "SELECT field1, field2, field3 FROM tablename WHERE field1 = 'something' " Is there any way to get "field1, field2, field3"? assuming it might also have join, left join - things like that. I can easily do it with preg_match, but I have to make sure its "foolproof". It would be a lot better if it will also be able to parse the whole query - catch limit, where, joins, comments.... Is there any php class that could do it? I've looked in the pear site and on Google but haven't had any luck. -- Use ROT26 for best security