当前位置: 编程技术>java/j2ee
java正则表达式应用的实例代码
来源: 互联网 发布时间:2014-10-21
本文导语: String str = "n1e你v00a?Az$Z000?#99?9900眯2_悄s3你y4@好?!6求救你d75a8t"; Pattern p= Pattern.compile("[u4e00-u9fa5]");//把汉字截取出来。 Matcher m= p.matcher(str); while(m.find()){ System.out.print(m.group()); } String str = "n1e你v00a?Az$Z000?#99?9900眯2_悄s3你y4@好?!6求救...
String str = "n1e你v00a?Az$Z000?#99?9900眯2_悄s3你y4@好?!6求救你d75a8t";
Pattern p= Pattern.compile("[u4e00-u9fa5]");//把汉字截取出来。
Matcher m= p.matcher(str);
while(m.find()){
System.out.print(m.group());
}
String str = "n1e你v00a?Az$Z000?#99?9900眯2_悄s3你y4@好?!6求救你d75a8t";
String a = "";
String b = "";
String d = "";
String s = "";
for(int i = 0;i
Pattern p= Pattern.compile("[u4e00-u9fa5]");//把汉字截取出来。
Matcher m= p.matcher(str);
while(m.find()){
System.out.print(m.group());
}
String str = "n1e你v00a?Az$Z000?#99?9900眯2_悄s3你y4@好?!6求救你d75a8t";
String a = "";
String b = "";
String d = "";
String s = "";
for(int i = 0;i