RegexUtils

object RegexUtils
author: Blankj
blog  : http://blankj.com
time  : 2016/08/02
desc  : utils about regex
*

Functions

getMatches
Link copied to clipboard
fun getMatches(regex: String?, input: CharSequence?): List<String>?
Return the list of input matches the regex.
getReplaceAll
Link copied to clipboard
fun getReplaceAll(input: String?, regex: String?, replacement: String?): String?
Replace every subsequence of the input sequence that matches the pattern with the given replacement string.
getReplaceFirst
Link copied to clipboard
fun getReplaceFirst(input: String?, regex: String?, replacement: String?): String?
Replace the first subsequence of the input sequence that matches the regex with the given replacement string.
getSplits
Link copied to clipboard
fun getSplits(input: String?, regex: String): Array<String>?
Splits input around matches of the regex.
isDate
Link copied to clipboard
fun isDate(input: CharSequence?): Boolean
Return whether input matches regex of date which pattern is "yyyy-MM-dd".
isEmail
Link copied to clipboard
fun isEmail(input: CharSequence?): Boolean
Return whether input matches regex of email.
isIDCard15
Link copied to clipboard
fun isIDCard15(input: CharSequence?): Boolean
Return whether input matches regex of id card number which length is 15.
isIDCard18
Link copied to clipboard
fun isIDCard18(input: CharSequence?): Boolean
Return whether input matches regex of id card number which length is 18.
isIP
Link copied to clipboard
fun isIP(input: CharSequence?): Boolean
Return whether input matches regex of ip address.
isMatch
Link copied to clipboard
fun isMatch(regex: String?, input: CharSequence?): Boolean
Return whether input matches the regex.
isMobileExact
Link copied to clipboard
fun isMobileExact(input: CharSequence?): Boolean
Return whether input matches regex of exact mobile.
isMobileSimple
Link copied to clipboard
fun isMobileSimple(input: CharSequence?): Boolean
Return whether input matches regex of simple mobile.
isPassword
Link copied to clipboard
fun isPassword(value: String): Boolean
数字和字母的结合 ( 6 - 20 位)
isTel
Link copied to clipboard
fun isTel(input: CharSequence?): Boolean
Return whether input matches regex of telephone number.
isURL
Link copied to clipboard
fun isURL(input: CharSequence?): Boolean
Return whether input matches regex of url.
isUsername
Link copied to clipboard
fun isUsername(input: CharSequence?): Boolean
Return whether input matches regex of username.
isZh
Link copied to clipboard
fun isZh(input: CharSequence?): Boolean
Return whether input matches regex of Chinese character.