62,634
社区成员




public static void main(String[] args) {
String str = "(1) P ((2)@!)";
Pattern p = Pattern.compile("(\\(\\d+\\))\\s*(\\w+)\\s*\\((\\(\\d+\\))(.+)\\)");
Matcher m = p.matcher(str);
String[] arr = null;
if(m.find()) {
arr = new String[]{m.group(1),m.group(2),m.group(3),m.group(4) };
}
for(String s : arr) {
System.out.println(s);
}
}