I am trying to get the regex for SQL insert query. I need to extract the table name from the query. What should be the regex for this ? I am using Java
I looked at this link but unable to get the table name. Regular expression to extract SQL query
I am trying to get the regex for SQL insert query. I need to extract the table name from the query. What should be the regex for this ? I am using Java
I looked at this link but unable to get the table name. Regular expression to extract SQL query
Regular Expressions are not full proof solution for extracting table names from SQL queries... As tons of things has to be considered, which would be trickier to express in RegX, and would break out in one or other cases....
You can use the following, ultra light, ultra fast library to do that in an elegant way
<dependency>
<groupId>com.github.mnadeem</groupId>
<artifactId>sql-table-name-parser</artifactId>
<version>0.0.1</version>
and Execute the following query
new TableNameParser(sql).tables()
For more details refer the project
Disclaimer: I am the owner of the library
For that type of query