regex

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RegexEmail         = regexp.MustCompile(patternEmail)
	RegexStrictEmail   = regexp.MustCompile(patternStrictEmail)
	RegexURL           = regexp.MustCompile(patternURL)
	RegexRGBColor      = regexp.MustCompile(patternRGBColor)
	RegexHexColor      = regexp.MustCompile(patternRegexHexColor)
	RegexAlphaNumeric  = regexp.MustCompile(patternLetterNumeric)
	RegexChinese       = regexp.MustCompile(patternChinese)
	RegexChineseName   = regexp.MustCompile(patternChineseName)
	RegexWord          = regexp.MustCompile(patternWord)
	RegexWhitespaceAll = regexp.MustCompile(patternWhitespaceAll)
	RegexWhitespaceHas = regexp.MustCompile(patternWhitespaceHas)
)

全局预编译regex

Functions

func HasWhitespace added in v0.1.6

func HasWhitespace(str string) bool

HasWhitespace 是否含有空白字符

func IsAlphaNumeric added in v0.1.6

func IsAlphaNumeric(s string) bool

IsAlphaNumeric 是否字母或数字.

func IsChinese added in v0.1.6

func IsChinese(str string) bool

IsChinese 字符串是否全部中文.

func IsChineseName added in v0.1.6

func IsChineseName(str string) bool

IsChineseName 字符串是否中文名.

func IsEmail

func IsEmail(s string) bool

IsEmail validates string is an email address, if not return false basically validation can match 99% cases

func IsEmailRFC

func IsEmailRFC(email string) bool

IsEmailRFC validates string is an email address, if not return false this validation omits RFC 2822

func IsHexColor added in v0.1.6

func IsHexColor(s string) (string, bool)

IsHexColor 检查是否十六进制颜色,并返回带"#"的修正值.

func IsRGBColor added in v0.1.6

func IsRGBColor(s string) bool

IsRGBColor 是否是rgb颜色格式 rgb(0,31, 255)

func IsURL

func IsURL(s string) bool

IsURL validates string is a url link, if not return false simple validation can match 99% cases

func IsWhitespaces added in v0.1.6

func IsWhitespaces(str string) bool

IsWhitespaces 是否全部空白字符,不包括空字符串.

func IsWord added in v0.1.6

func IsWord(str string) bool

IsWord 是否词语(不以下划线开头的中文、英文、数字、下划线、空格).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL