java提取中括号内容:(?<=\\[)(\\S+)(?=\\])
提取中括号所有内容:(?<=\\[)(.*)(?=\\])
private static StringreNameJobName(String name){
String reName ="";
String regex ="(?<=\\[)(\\S+)(?=\\])";
Pattern pattern = Pattern.compile (regex);
Matcher matcher = pattern.matcher (name);
while (matcher.find ())
{
reName = matcher.group ();
}
return reName;
}
网友评论