更新时间:2023-02-06 14:11:27
简单的解决方案是将所有关键字存储在 JavaScript数组
中>。
检查字符串是否存在于数组
中。就是这样。
Simple solution is to store all the keywords in a JavaScriptArray
.
Check if the string is present in theArray
or not. That's it.
var str = "select * from employee";
str = str.toLowerCase()
var res = str.match(/select/ltrim/rtirm/where/group by/from/asc);
The result of res will be an array with the values:
select,from etc.