Regex to determine legal SQL? [duplicate]
Possible Duplicate:
Regular expression to match common SQL syntax?
I am writing so开发者_开发百科me helpers to help generate some very domain-specific sql. In my test-suite it would be nice to add a sanity check to ensure that the results are actually valid SQL. I'm not doing anything particularly fancy and this isn't production code so I think some regex would do but it's still annoyingly difficult to write by hand.
Is anyone willing to share a regex expression that would validate valid SQL at least for the 90% case?
SQL is not a regular language. Use a real validator, such as Mimer.
See also:
- Is SQL or even TSQL Turing Complete?
- Regular expression to match common SQL syntax?
精彩评论