regexnew

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WhitespaceFinderRegex             = NewMust(regconsts.AllWhitespaces)
	HashCommentWithSpaceOptionalRegex = NewMust(regconsts.HashCommentWithSpaceOptional)
	WhitespaceOrPipeFinderRegex       = NewMust(regconsts.AllWhitespacesOrPipe)
	DollarIdentifierRegex             = NewMust(regconsts.EachWordsWithDollarSymbolDefinition)
	PercentIdentifierRegex            = NewMust(regconsts.EachWordsWithinPercentSymbolDefinition)
)

Functions

func IsMatchFailed added in v0.8.0

func IsMatchFailed(regex, comparing string) bool

IsMatchFailed creates new regex using lock and then calls match if doesn't match returns true

func IsMatchLock added in v0.7.6

func IsMatchLock(regex, comparing string) bool

IsMatchLock creates new regex using lock and then calls match if doesn't match or invalid regex then returns false.

func MatchError added in v0.9.5

func MatchError(regex, comparing string) error

MatchError

creates new regex using without lock (use in vars) and then calls match. On condition mismatch returns error or else nil

func MatchErrorLock added in v0.7.6

func MatchErrorLock(regex, comparing string) error

MatchErrorLock

creates new regex using lock and then calls match. On condition mismatch returns error or else nil

func MatchUsingCustomizeErrorFuncLock added in v0.9.5

func MatchUsingCustomizeErrorFuncLock(
	regexPattern, comparing string,
	matchFunc RegexValidationFunc,
	customizeErrFunc CustomizeErr,
) error

MatchUsingCustomizeErrorFuncLock

creates new regex using lock and then calls match. On condition mismatch returns error or else nil

func MatchUsingFuncErrorLock added in v0.9.5

func MatchUsingFuncErrorLock(
	regexPattern, comparing string,
	matchFunc RegexValidationFunc,
) error

MatchUsingFuncErrorLock

creates new regex using lock and then calls match. On condition mismatch returns error or else nil

func New

func New(regularExpressionPattern string) (*regexp.Regexp, error)

New creates regex if not already exist in dictionary.

if any error then doesn't save to map and returns the error

func NewLock

func NewLock(regularExpressionPattern string) (*regexp.Regexp, error)

NewLock calls New with mutex lock and unlock.

func NewLockIf added in v0.6.9

func NewLockIf(isLock bool, regularExpressionSyntax string) (*regexp.Regexp, error)

NewLockIf calls New with mutex lock and unlock if true.

func NewMust

func NewMust(regularExpressionSyntax string) *regexp.Regexp

NewMust creates regex if not already exist in dictionary.

if any error then panics

func NewMustLock

func NewMustLock(regularExpressionSyntax string) *regexp.Regexp

func NewMustLockIf added in v0.6.9

func NewMustLockIf(
	isLock bool,
	regularExpressionSyntax string,
) *regexp.Regexp

Types

type CustomizeErr added in v0.9.5

type CustomizeErr func(
	regexPattern,
	matchLookingTerm string,
	err error,
	regexp *regexp.Regexp,
) error

type RegexValidationFunc added in v0.9.5

type RegexValidationFunc func(regex *regexp.Regexp, lookingTerm string) bool

Jump to

Keyboard shortcuts

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