validators

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2023 License: GPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PhonenumberRegex       = `^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$`
	EmailRegex             = `^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$`
	DigitRegex             = `^[0-9]+$`
	AlphaRegex             = `^[a-zA-Z]+$`
	AlphaNumericRegex      = `^[a-zA-Z0-9]+$`
	AlphaNumericSpaceRegex = `^[a-zA-Z0-9 ]+$`
	SlugRegex              = `^[a-z0-9-]+$`
)

Regex for validation.

Variables

This section is empty.

Functions

func EmptyCheck

func EmptyCheck(str ...string) bool

Returns true if any of the strings are empty.

func IsAlpha

func IsAlpha(strings ...string) bool

Returns true if input is an alphabetic string.

func IsAlphaNumeric

func IsAlphaNumeric(strings ...string) bool

Returns true if input is an alphanumeric string.

func IsAlphaNumericWSpaces

func IsAlphaNumericWSpaces(strings ...string) bool

Returns true if input is an alphanumeric string with spaces.

func IsDigit

func IsDigit(strings ...string) bool

Returns true if input is digit.

func IsEmail

func IsEmail(strings ...string) bool

Returns true if input is emailaddress.

func IsPhonenumber

func IsPhonenumber(strings ...string) bool

Returns true if input is phonenumber.

func IsSlug

func IsSlug(strings ...string) bool

Returns true if input is slug format.

func IsValidLength

func IsValidLength(min, max int, str ...string) bool

Returns true if valid. Returns false if length is less than min or greater than max.

func IsValidRegex

func IsValidRegex(regex string, strings ...string) bool

Returns true if valid. Returns false if regex does not match for any of the strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

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