zvalidator

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PatternEmail is email
	PatternEmail = "" /* 133-byte string literal not displayed */
	// PatternIP is ip
	PatternIP = `` /* 659-byte string literal not displayed */
	// PatternURLSchema is URL schema
	PatternURLSchema = `((ftp|tcp|udp|wss?|https?):\/\/)`
	// PatternURLUsername is URL username
	PatternURLUsername = `(\S+(:\S*)?@)`
	// PatternURLPath is URL path
	PatternURLPath = `((\/|\?|#)[^\s]*)`
	// PatternURLPort is URL port
	PatternURLPort = `(:(\d{1,5}))`
	// PatternURLIP is URL ip
	PatternURLIP = `([1-9]\d?|1\d\d|2[01]\d|22[0-3])(\.(1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-4]))`
	// PatternURLSubdomain is URL subdomain
	PatternURLSubdomain = `((www\.)|([a-zA-Z0-9]([-\.][-\._a-zA-Z0-9]+)*))`
	// PatternURL is URL
	PatternURL = `^` + PatternURLSchema + `?` + PatternURLUsername + `?` + `((` + PatternURLIP + `|(\[` + PatternIP + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + PatternURLSubdomain + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + PatternURLPort + `?` + PatternURLPath + `?$`
)

Variables

This section is empty.

Functions

func IsEmail

func IsEmail(str string) bool

IsEmail checks if the string is email.

func IsIP

func IsIP(str string) bool

IsIP checks if the string is valid IP.

func IsIPv4

func IsIPv4(str string) bool

IsIPv4 checks if the string is valid IPv4.

func IsIPv6

func IsIPv6(str string) bool

IsIPv6 checks if the string is valid IPv6.

func IsJSON

func IsJSON(str string) bool

IsJSON check if the string is valid JSON (note: uses json.Unmarshal).

func IsPort

func IsPort(str string) bool

IsPort checks if a string represents a valid port.

func IsTime

func IsTime(str string, format string) bool

IsTime check if string is valid according to given format

func IsURL

func IsURL(str string) bool

IsURL checks if the string is URL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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