Java正则表达式验证字符串

2021-04-06 16:42:32
```java import java.util.regex.Pattern; class App{ public static void main(String[] args){ System.out.println(Pattern.matches("^[a-zA-Z0-9]{4,6}$", "jack")); System.out.println(Pattern.matches("^[a-zA-Z0-9]{4,6}$", "jackmary")); } } ```