import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
Pattern pattern=Pattern.compile("[0-9]+"); // 匹配数字位从一个到九个中间一个到多个
Matcher m=pattern.matcher("1234");
boolean mathes=m.matches();
System.out.println(mathes);
Pattern pattern1=Pattern.compile("\\d"); //匹配 数字
Matcher m1=pattern.matcher("1234");
boolean mathes1=m1.matches();
System.out.println(mathes1);
Pattern pattern2=Pattern.compile("\\w"); // 表示匹配字母
Matcher m2=pattern.matcher("ssss");
boolean mathes2=m2.matches();
System.out.println(mathes1);
}
}