我现在有一段字符:#¥%%哈哈15241ADF*&*%……
我现在想截取 哈哈15241ADF 这段字符,应该要怎么写?Pattern pattern = Pattern.compile(".+?\\[(*+?)\\]*+?");
Matcher matcher = pattern.matcher(s);
if (matcher.matches()) {
String group = matcher.group(1);
System.out.println(group);
} else {
System.out.println("no matches!!");
}
我现在想截取 哈哈15241ADF 这段字符,应该要怎么写?Pattern pattern = Pattern.compile(".+?\\[(*+?)\\]*+?");
Matcher matcher = pattern.matcher(s);
if (matcher.matches()) {
String group = matcher.group(1);
System.out.println(group);
} else {
System.out.println("no matches!!");
}
String exp = "([0-9a-zA-Z\u4E00-\u9FA5]+)";
Pattern p = Pattern.compile(exp);
Matcher m = p.matcher(s);
if(m.find()){
System.out.println(m.group());
}