String re="行政专员(袁文全)";
String rex="[()]+";
String[] str=re.split(rex);
System.out.print(str[1]);
还有一个不是正则表达式的
String re="行政专员(袁文全)";
String str=re.substring(re.lastIndexOf("("),re.lastIndexOf(")"));
String s=str.substring(1,str.length());
System.out.print(s);
Pattern p = Pattern.compile("\\(([^\\)]+)");
Matcher matcher = p.matcher("行政专员(袁文全)");
if (matcher.find() && matcher.groupCount() >= 1){
System.out.println(matcher.group(1));
}
Pattern p = Pattern.compile("\\(([^\\)]+)");Matcher matcher = p.matcher("行政专员(袁文全)");if (matcher.find() && matcher.groupCount() >= 1){System.out.println(matcher.group(1)); }
System.out.println( str.replaceAll(".*\\(|\\).*", ""));