I'm trying to validate a these 2 simple sql queries
String sql1 = "select * from table".toLowerCase();
String sql2 = "select value from table".toLowerCase();
using this pattern
String pattern = "(select)(\\s)([\\*|\\w+])(\\s)(from)(\\s\\w+)";
then I print the value
System.out.println(sql1.matches(pattern)); // true
System.out.println(sql2.matches(pattern)); // false
the first one is ok, but I'm getting false in the second statement. Can someone help?