public final class RegexUtils extends Object
| 构造器和说明 |
|---|
RegexUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
findFirst(String originalStr,
String regex)
Finds the first match string from originalStr use regex
|
static String |
findGroup(String originalStr,
String regex,
int group) |
static int |
getPhoneCarrier(String mobilePhone)
获取移动号码运营商类型
|
static boolean |
isDatePattern(String text)
Validates the text whether date pattern
|
static boolean |
isEmail(String text)
校验是否邮箱地址
|
static boolean |
isIpv4(String text)
校验是否ipv4地址
|
static boolean |
isIpv6(String text)
校验是否ipv6地址
|
static boolean |
isMobilePhone(String text)
check is china mobile phone
|
static boolean |
isValidPassword(String text)
校验是否是有效的密码:
> 8-20位
> 必须包含字母、数字、符号中至少2种(可选的符号包括:@#!
|
static boolean |
isValidUserName(String text)
校验是否是有效的用户名
数据库用户名字段最好不要区分大小写
|
static boolean |
matches(String originalStr,
String regex) |
public static String findFirst(String originalStr, String regex)
originalStr - the origin strregex - the regexpublic static boolean isMobilePhone(String text)
text - true is mobile phonepublic static boolean isEmail(String text)
text - true is email addresspublic static boolean isIpv4(String text)
text - true is ipv4 addresspublic static boolean isIpv6(String text)
text - true is ipv6 addresspublic static boolean isValidUserName(String text)
text - true is valid user namepublic static boolean isValidPassword(String text)
text - true is valid passwordpublic static boolean isDatePattern(String text)
text - the stringtrue then is a valid date patternpublic static int getPhoneCarrier(String mobilePhone)
mobilePhone - the mobile phoneCopyright © 2023. All rights reserved.