public class RegExpUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
NICK_NAME_REG
用户昵称正则
|
static String |
REGEX_BLANK_LINE
Regex of blank line.
|
static String |
REGEX_CHINA_POSTAL_CODE
Regex of postal code in China.
|
static String |
REGEX_DATE
Regex of date which pattern is "yyyy-MM-dd".
|
static String |
REGEX_DOUBLE_BYTE_CHAR
Regex of double-byte characters.
|
static String |
REGEX_EMAIL
Regex of email.
|
static String |
REGEX_ID_CARD15
Regex of id card number which length is 15.
|
static String |
REGEX_ID_CARD18
Regex of id card number which length is 18.
|
static String |
REGEX_INTEGER
Regex of integer.
|
static String |
REGEX_IP
Regex of ip address.
|
static String |
REGEX_MOBILE_EXACT
Regex of exact mobile.
|
static String |
REGEX_MOBILE_SIMPLE
Regex of simple mobile.
|
static String |
REGEX_NEGATIVE_FLOAT
Regex of negative float.
|
static String |
REGEX_NEGATIVE_INTEGER
Regex of negative integer.
|
static String |
REGEX_NOT_NEGATIVE_INTEGER
Regex of non-negative integer.
|
static String |
REGEX_NOT_POSITIVE_INTEGER
Regex of non-positive integer.
|
static String |
REGEX_POSITIVE_FLOAT
Regex of positive float.
|
static String |
REGEX_POSITIVE_INTEGER
Regex of positive integer.
|
static String |
REGEX_QQ_NUM
Regex of QQ number.
|
static String |
REGEX_TEL
Regex of telephone number.
|
static String |
REGEX_URL
Regex of url.
|
static String |
REGEX_USERNAME
Regex of username.
|
static String |
REGEX_ZH
Regex of Chinese character.
|
| Constructor and Description |
|---|
RegExpUtils() |
| Modifier and Type | Method and Description |
|---|---|
static List<String> |
getMatches(String regex,
CharSequence input)
Return the list of input matches the regex.
|
static String |
getReplaceAll(String input,
String regex,
String replacement)
Replace every subsequence of the input sequence that matches the
pattern with the given replacement string.
|
static String |
getReplaceFirst(String input,
String regex,
String replacement)
Replace the first subsequence of the input sequence that matches the
regex with the given replacement string.
|
static String[] |
getSplits(String input,
String regex)
Splits input around matches of the regex.
|
static boolean |
isDate(CharSequence input)
Return whether input matches regex of date which pattern is "yyyy-MM-dd".
|
static boolean |
isEmail(CharSequence input)
Return whether input matches regex of email.
|
static boolean |
isIDCard15(CharSequence input)
Return whether input matches regex of id card number which length is 15.
|
static boolean |
isIDCard18(CharSequence input)
Return whether input matches regex of id card number which length is 18.
|
static boolean |
isIP(CharSequence input)
Return whether input matches regex of ip address.
|
static boolean |
isMatch(String regex,
CharSequence input)
Return whether input matches the regex.
|
static boolean |
isMobileExact(CharSequence input)
Return whether input matches regex of exact mobile.
|
static boolean |
isMobileSimple(CharSequence input)
Return whether input matches regex of simple mobile.
|
static boolean |
isTel(CharSequence input)
Return whether input matches regex of telephone number.
|
static boolean |
isURL(CharSequence input)
Return whether input matches regex of url.
|
static boolean |
isUsername(CharSequence input)
Return whether input matches regex of username.
|
static boolean |
isZh(CharSequence input)
Return whether input matches regex of Chinese character.
|
public static final String REGEX_MOBILE_SIMPLE
public static final String REGEX_MOBILE_EXACT
china mobile: 134(0-8), 135, 136, 137, 138, 139, 147, 150, 151, 152, 157, 158, 159, 178, 182, 183, 184, 187, 188, 198
china unicom: 130, 131, 132, 145, 155, 156, 166, 171, 175, 176, 185, 186
china telecom: 133, 153, 173, 177, 180, 181, 189, 199
global star: 1349
virtual operator: 170
public static final String REGEX_TEL
public static final String REGEX_ID_CARD15
public static final String REGEX_ID_CARD18
public static final String REGEX_EMAIL
public static final String REGEX_URL
public static final String REGEX_ZH
public static final String REGEX_USERNAME
scope for "a-z", "A-Z", "0-9", "_", "Chinese character"
can't end with "_"
length is between 6 to 20
public static final String REGEX_DATE
public static final String REGEX_IP
public static final String REGEX_DOUBLE_BYTE_CHAR
public static final String REGEX_BLANK_LINE
public static final String REGEX_QQ_NUM
public static final String REGEX_CHINA_POSTAL_CODE
public static final String REGEX_POSITIVE_INTEGER
public static final String REGEX_NEGATIVE_INTEGER
public static final String REGEX_INTEGER
public static final String REGEX_NOT_NEGATIVE_INTEGER
public static final String REGEX_NOT_POSITIVE_INTEGER
public static final String REGEX_POSITIVE_FLOAT
public static final String REGEX_NEGATIVE_FLOAT
public static final String NICK_NAME_REG
public static boolean isMobileSimple(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isMobileExact(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isTel(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isIDCard15(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isIDCard18(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isEmail(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isURL(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isZh(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isUsername(CharSequence input)
scope for "a-z", "A-Z", "0-9", "_", "Chinese character"
can't end with "_"
length is between 6 to 20
.input - The input.true: yesfalse: nopublic static boolean isDate(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isIP(CharSequence input)
input - The input.true: yesfalse: nopublic static boolean isMatch(String regex, CharSequence input)
regex - The regex.input - The input.true: yesfalse: nopublic static List<String> getMatches(String regex, CharSequence input)
regex - The regex.input - The input.public static String[] getSplits(String input, String regex)
input - The input.regex - The regex.public static String getReplaceFirst(String input, String regex, String replacement)
input - The input.regex - The regex.replacement - The replacement string.public static String getReplaceAll(String input, String regex, String replacement)
input - The input.regex - The regex.replacement - The replacement string.Copyright © 2021 Clouds Studio. All rights reserved.