Documentation
¶
Index ¶
- Variables
- func IsCellphoneOfChina(str string) bool
- func IsEmail(str string) bool
- func IsIPv4(str string) bool
- func IsInternalIPv4(str string) bool
- func IsTelephoneOfChina(str string) bool
- func IsTimeHourPoint(str string) bool
- func IsWebDomain(str string) bool
- func RegularMatchString(patten string, s string) (bool, error)
- func RegularReplaceMatch(patten string, original string, replace string) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RegularOfWebDomain = regexp.MustCompile(`^(http://|https://)?(\d{1,3}(.\d{1,3}){3}|(www.)?[^www.][a-z]+\.[a-z]+)(:\d+)?$`) RegularOfIPv4 = regexp.MustCompile(`^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$`) RegularOfInternalIPv4 = regexp.MustCompile(`(^127\.)|(^10\.)|(^172\.(1[6-9]|2[0-9]|3[0-1])\.)|(^192\.168\.)`) RegularOfCellphone = regexp.MustCompile(`^(\+86(-|\s)?)?1[3-9][0-9]{9}$`) RegularOfTelephone = regexp.MustCompile(`^(\d{3,4}-)?[1-9][0-9]{4,8}$`) RegularOfEmail = regexp.MustCompile(`^[a-zA-Z0-9]{1,20}(([._\-])?[a-zA-Z0-9]{1,20})*@[a-z0-9]+(\.([a-z]+))+$`) )
Functions ¶
func IsCellphoneOfChina ¶
IsCellphoneOfChina regular expression is used to check whether the telephone number is china.
func IsInternalIPv4 ¶
IsInternalIPv4 Use a regular expression to check whether the ip address is ipv4.
func IsTelephoneOfChina ¶
IsTelephoneOfChina regular expression is used to check whether the telephone number is china.
func IsTimeHourPoint ¶ added in v0.2.3
IsTimeHourPoint matched time str is time hour point. str similar 00:01/05:28/19:25/23:59
func IsWebDomain ¶ added in v0.2.0
IsWebDomain Use a regular expression to check whether the web domain is valid.
func RegularMatchString ¶ added in v0.1.2
RegularMatchString reports whether the string s contains any match of the regular expression pattern. More complicated queries need to use Compile and the full Regexp interface.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.