In this regex I'm trying to extract the list of tables from a SQL select statement. It works fine with one exception, if the statement ends with the table name there is no match. For example:
Given he regex:
(?:from|join)\s+(.*?)(?:\)|\s+(?:where|on|inner|outer|full|left|right|join|\s*$))
and given this string:
"select xxxx from table1 t1, table2, table3 t3 " (note the last space)
The match is:
"table1 t1, table2, table3 t3"
But given this string:
"select xxxx from table1 t1, table2, table3 t3" (without last space)
There's no match. How to make this work?