请教一下,java 如何使用正则提取大括号里面的所有字符串
public static void main(String[] args) {
String content="${中国} ${广东} ${深圳} ${10086}";
}
请教一下,java 如何使用正则提取大括号里面的所有字符串
public static void main(String[] args) {
String content="${中国} ${广东} ${深圳} ${10086}";
}
public static void main(String[] args) {
String content="${中国} ${广东} ${深圳} ${10086}";
Pattern pattern = Pattern.compile("\\$\\{(.+?)\\}");
Matcher matcher = pattern.matcher(content);
while (matcher.find()) {
System.out.println(matcher.group(1));
}
}