String s = "abc =123";
int DEFAULT_PATTERN_FLAGS = Pattern.CASE_INSENSITIVE | Pattern.DOTALL;
Pattern p = Pattern.compile("(\\S[^=]++)\\s*+=\\s*+(\\S++)", DEFAULT_PATTERN_FLAGS);
Matcher m = p.matcher(s);
if (m.find()) {
System.out.println("found groups: " + m.groupCount());
for (int i = 0; i <= m.groupCount(); ++i) {
System.out.println(m.group(i));
}
} else {
System.out.println("not found");
}
abc =123
abc (actual is abc[whitespace])
123
there's whitespace after abc, \S should not match whitespace, but (\S[^=]++) did
use (\S[^=]+?) can work right, but I want to know why (\S[^=]++) not work
thanks for help