求一个java正则表达式 Pattern p = Pattern.compile("([\u4E00-\u9FA5]+)"); Matcher m = p.matcher("[aa/]小米[/aa]"); while(m.find()){ System.out.println(m.group(1)); }每次替换中间的"[aa/]小米[/aa]"即可 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Pattern p=Pattern.compile("(?<=\\]).*(?=\\[)"); Matcher m=p.matcher("[aa/]小米AAA[/aa]"); while(m.find()){ System.out.println(m.group()); } Matcher m = Pattern.compile("\\[[a-z/]+\\](.*?)\\[[a-z/]+\\]").matcher("[aa/]小米[/aa]"); while(m.find()){ System.out.println(m.group(1)); } System.out.println("[aa/]小米[/aa]".replaceAll("\\[[a-z/]+\\](.*?)\\[[a-z/]+\\]", "$1")); Matcher m = Pattern.compile("\\[([a-z]+)/\\].+?\\[/\\1\\]").matcher("[aa/]小米[/aa]"); while(m.find()){ System.out.println(m.group(2)); } 又来麻烦前辈们了QAQ :关于覆写hashCode()方法 能不能格式化数字的显示:数字1显示为01 javascript中怎么调用java代码 输出格式 xml的格式化缩进,答对者百分相送 3级菜单如何加 我3个月的BABY的像片,大家看看,并请投一票 紧急求助(毕业设计用):GUI设计的显示问题,多谢 加密解密程序中遇到的困惑问题?含样例程序,求解决!谢了! java client端实现技术方案,求救! Java 静态块能否实现传参? 关于Mac 下的java环境配置
Matcher m=p.matcher("[aa/]小米AAA[/aa]");
while(m.find()){
System.out.println(m.group());
}
while(m.find()){
System.out.println(m.group(1));
}
Matcher m = Pattern.compile("\\[([a-z]+)/\\].+?\\[/\\1\\]").matcher("[aa/]小米[/aa]");
while(m.find()){
System.out.println(m.group(2));
}