求大神帮忙写个java匹配#{}的正则表达式,不包含#{},取#{}中的值。
public static void main(String[] args) {
String regex = "\\#\\{([^}]*)\\}";//匹配大括号
// private static String regexx = "\\(([^}]*)\\)";//匹配小括号
String dakuohao = "{a+b}=#{c+d}>#{d}";
Pattern compile = Pattern.compile(regex);
Matcher matcher = compile.matcher(dakuohao);
while(matcher.find()){
String group = matcher.group();
System.out.print(group+";");
}
}
这个是可以匹配并取到值的,但值中有#{},我想只取内容不带#{}。求大神指点