Please, read my comment to the question.
All you need to do is to find
FROM
word than to extract table name.
How to: Search Strings Using String Methods (C# Programming Guide)[
^]
How to: Search Within a String (Visual Basic)[
^]
How to: Search Strings Using Regular Expressions (C# Programming Guide)[
^] - true, it's c#, but you can convert it via for example
developerfusion online converter[
^]
But i need to warn you. In some cases, sql query could looks like:
SELECT <field list>
FROM (
SELECT <field list>
FROM TableName
WHERE <condition>
) AS T
WHERE <condition>
What do you expect to find?
Please, read these articles:
SQL Parser[
^]
Microsoft.SqlServer.Management.SqlParser.Parser Namespace[
^]
There you'll find many usefull information.