Java Regular Expression application instance code, java Regular Expression instance
String str = "n1e your v00a? Az $ Z000? #99? 9900 MI 2 _ quiet s3 you y4 @ OK ?! 6. Ask for your d75a8t ";
Pattern p = Pattern. compile ("[\ u4e00-\ u9fa5]"); // extract Chinese characters.
Matcher m = p. matcher (str );
While (m. find ()){
System. out. print (m. group ());
}
String str = "n1e your v00a? Az $ Z000? #99? 9900 MI 2 _ quiet s3 you y4 @ OK ?! 6. Ask for your d75a8t ";
String a = "";
String B = "";
String d = "";
String s = "";
For (int I = 0; I <str. length (); I ++ ){
Char c = str. charAt (I );
If (48 <= c & c <= 58 ){
A + = c;
} Else if (64 <= c & c <= 91 ){
B + = c;
} Else if (96 <= c & c <= 123 ){
B + = c;
} Else {
If (String. valueOf (c). getBytes (). length)> 1 ){
D + = c;
} Else {
S + = c;
}
}
}
System. out. println ();
System. out. println (B );
System. out. println (d );
System. out. println (s );