Using Regex to extract table names from a file containing SQL queries

后端 未结 5 753
慢半拍i
慢半拍i 2021-01-05 11:28

I\'ve a text file containing large number of queries. I want to get all the distinct tables used in the entire file in all the queries. The table name can come after a \'fro

5条回答
  •  渐次进展
    2021-01-05 11:57

    Something like this maybe:

    /(from|join)\s+(\w*\.)*(?\w+)/
    

    It won't match escaped table names though, and you need to make the regex evaluation case-insensitive.

提交回复
热议问题