java实现截取两个特殊字符中间的字符串

public static void main(String[] args) {
String str="jlfjal#jfjfl%jfjjj";
String regex="#(.*?)%";
Pattern p=Pattern.compile(regex);
Matcher m=p.matcher(str);
while(m.find()){
System.out.println(m.group(1));
}
}
}运行结果:
jfjfl

猜你喜欢

转载自blog.csdn.net/guo_xiao_hui/article/details/84853229
今日推荐