Java正则表达式 做校验验证字符串中全是字符和数字组成

验证字符串中全是字符和数字组成        

         String regex = "^[a-zA-Z0-9-]+$";

        Pattern pattern = Pattern.compile(regex);
        Matcher match = pattern.matcher("612356032223");
        System.out.println(match.matches());;

猜你喜欢

转载自blog.csdn.net/chuan_zhang_ak/article/details/79706437