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
This will pull out a table name on an insert Into query:
(?<=(INTO)\s)[^\s]*(?=\(())
The Following will do the same but with a select including joins
(?<=(from|join)\s)[^\s]*(?=\s(on|join|where))
Finally going back to an insert if you want to return just the values that are held in an insert query use the following Regex
(?i)(?<=VALUES[ ]*\().*(?=\))
I know this is an old thread but it may assist someone else looking around
Enjoy