When i use this code, i don't have the expected result :
pattern = Pattern.compile("create\\stable\\s(\\w*)\\s\\(", Pattern.CASE_INSENSITIVE);
matcher = pattern.matcher("create table CONTACT (");
if(matcher.matches()) {
for(int i =0; i<matcher.groupCount();i++) {
System.out.println("table : " + matcher.group(i) + matcher.start(i) + " - " + matcher.end(i));
}
}
}
I expect to catch CONTACT but the regex catch the whole expression "create table CONTACT (". Has someone an idea of the problem ?
Thanks