正则表达式获取匹配字符串
String s = "姓名是${name},密码是${password}";
Pattern pat = Pattern.compile("\\$\\{[a-zA-Z0-9_-]*\\}");
Matcher mat = pat.matcher(s);
while(mat.find()){
String mm=mat.group(0);
String[] str=mm.split("\\{");
String[] str2=str[1].split("\\}");
System.out.println(str2[0]);
}
http://www.cnblogs.com/xuehen/