我想像这样提取部分 SQL 字符串:
SELECT *,somecolumn, anothercolum FROM sometable INNER JOIN anotherTable WHERE somecolumn>1
在变量中:
aVariable = "*,somecolumn, anothercolum";
anotherVariable = "sometable INNER JOIN anotherTable";
Vaiable = "somecolumn>1";
我试过这个(在 JavaScript 中):
/SELECT\s(\*|[\w\,\_\d]+)\sFROM\s([\w\,\_]]+)(?:\s(.*))
但它失败了INNER JOIN
。