Regular expression to find all table names in a query

前端 未结 12 989
一个人的身影
一个人的身影 2020-12-03 18:09

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

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 18:50

    I think it would be easier to tokenize the string and look for SQL keywords that could bound the table names. You know the names will follow FROM, but they could be followed by WHERE, GROUP BY, HAVING, or no keyword at all if they're at the end of the query.

提交回复
热议问题