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

后端 未结 5 719
慢半拍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:49

    It depends on structure of your file. Try to use this:

    (?<=from|join)(\s+\w+\b)
    

    Also turn on options Multiline if your not split your file in array or smth else with singleline string members. Also try to turn on IgnorCase option.

提交回复
热议问题