/^(\w+)(?:\[(\w+=\w+)(?:\s(\w+=\w+))*\])?$/
Pattern pathPattern = Pattern.compile("^(\\w+)(?:\\[(\\w+=\\w+)(?:\\s+(\\w+=\\w+))*\\])?$");
String inpt= "object[attr1=val1 attr2=val2 attr3=val3]";
Pattern pathPattern = Pattern.compile("\\w{1,}=\\w{1,}");
Matcher matcher = pathPattern.matcher(inpt);
// перебор по результатам
while(matcher.find()){
String tmp = inpt.substring(matcher.start(), matcher.end()) ;
System.out.println(tmp);
}
Pattern pathPattern = Pattern.compile("(\\w+=\\w+\\s*)");
Matcher matcher = pathPattern.matcher("sdf=ff ggg=dd hhh=44 jjj=5456");
while (matcher.find()) {
for (int i=1; i<=matcher.groupCount(); i++) {
System.out.println(matcher.group(i));
}
}
sdf=ff ggg=dd hhh=44 jjj=5456