public static void main(String[] args) {
String s = "计算机11602-1604240844-木叶-作业2.ipynb";
String rex = "[\\u4e00-\\u9fa5]{2,3}\\d{5}-\\d{10}-[\\u4e00-\\u9fa5]{2,4}-作业\\d{1}";
Pattern compile = Pattern.compile(rex);
Matcher matcher = compile.matcher(s);
if(matcher.find()){
String collegeId = matcher.group(0);
System.out.println(collegeId);
}
}
正则表达式提取字符
猜你喜欢
转载自blog.csdn.net/weixin_38331049/article/details/88932365
今日推荐
周排行