I want to find a sequence of “select from where ” in a string. For example,
"select * from T WHERE t.c1 =1"
should be matched.
Here is the regular expression pattern I wrote:
"SELECT\s\.*FROM\s\.*WHERE\s\.*";
But it doesn’t work. What is wrong with it?
You shouldn’t have backslash-escaped the dots; since you did, the engine is trying to match a literal dot, not “any character” like you’re expecting.
Try:
Also, as others have posted, make sure it’s in case-insensitive mode. How you do that depends on the language you’re using.