正则表达式验证 @param regex 正则表达式 @param str 需要验证的字符串 @return
(String regex, String str)
| 512 | * @return |
| 513 | */ |
| 514 | public static boolean match(String regex, String str) { |
| 515 | Pattern pattern = Pattern.compile(regex); |
| 516 | Matcher matcher = pattern.matcher(str); |
| 517 | return matcher.matches(); |
| 518 | } |
| 519 | |
| 520 | |
| 521 | /** |