日期:2014-05-20 浏览次数:20960 次
public static void main(String[] args) {
String str ="02/S20080989 我国的犯罪分子日益猖獗应该加大打击力度 身份证:452324198003220911 驾证:贵60342343234 电话 0788-35532343 出入证:2323342553(高) 202,701";
str = str.replaceAll( "^\\d+/([a-zA-Z]\\d+).*?:(\\d+[a-zA-Z]*).*?:(.\\d+).*?(\\d+-\\d+).*?:(\\d+\\(.\\)).*" , "$1 $2 $3 $4 $5" );
System.out.println(str);
}
------解决方案--------------------
String str="02/S20080989 我国的犯罪分子日益猖獗应该加大打击力度" +
" 身份证:452324198003220911 驾证:贵60342343234 " +
"电话 0788-35532343 出入证:2323342553(高) 202,701";
Pattern p=Pattern.compile("(S\\d*).*:(\\d*).*:(.\\d*).*?(\\d*-\\d*).*:(\\d*...)");
Matcher m=p.matcher(str);
while(m.find()){
System.out.println(m.group(1));
System.out.println(m.group(2));
System.out.println(m.group(3));
System.out.println(m.group(4));
System.out.println(m.group(5));
}