import java.util.regex.Pattern;

public class Test_REG {
    public static void main(String[] args) {
        //只允许输入6位数字
        String pattern = "[0-9]{6}";
        boolean isMatch = Pattern.matches(pattern, "123456");
        System.out.println(isMatch);
    }
}

 

相关文章:

  • 2022-12-23
  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
  • 2021-06-06
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案