regex

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 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

func HasWhitespace(str string) bool

HasWhitespace 是否含有空白字符

func IsAlphaNumeric

func IsAlphaNumeric(s string) bool

IsAlphaNumeric 是否字母或数字.

func IsChinese

func IsChinese(str string) bool

IsChinese 字符串是否全部中文.

func IsChineseName

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

func IsHexColor(s string) (string, bool)

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

func IsRGBColor

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

func IsWhitespaces(str string) bool

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

func IsWord

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