62,614
社区成员
发帖
与我相关
我的任务
分享
package day01;
import java.io.*;
import java.util.regex.*;
public class Test1
{
public static void main(String[] args)
{
String str = "龙的传人";
String regex="[\u4E00-\u9FA5]*";
Matcher m=Pattern.compile(regex).matcher(str);
while(m.find()){
System.out.println(1);
System.out.println(m.group());
}
}
}
import java.io.*;
import java.util.regex.*;
public class RRR1
{
public static void main(String[] args)
{
String str = "3龙3";
String regex="\\w";
Matcher m=Pattern.compile(regex).matcher(str);
while(m.find()){
System.out.println(m.group());
}
}
}