String reg1 = ".*性别:([^\\|]*)\\|?.*";String reg2 = ".*民族:([^\\|]*)\\|?.*";String reg3 = ".*生日:([^\\|]*)\\|?.*"; String str = "性别:女士|民族:汉族|生日:1990-9-22"; String sex = str.replaceAll(reg1, "$1");String mz = str.replaceAll(reg2, "$1");String brith = str.replaceAll(reg3, "$1");System.out.println (sex);System.out.println (mz);System.out.println (brith);
String str = "房估字(2014)第YPQD0006号";String jieguo = str.substring(str.indexOf("第")+1,str.indexOf("号"));