matchpattern

package
v1.14.10 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 5 Imported by: 21

Documentation

Index

Constants

View Source
const MatchAllAnchoredPattern = "(?:)"

MatchAllAnchoredPattern is the simplest pattern that match all inputs. This resulting parsed regular expression is the same as an empty string regex (""), but this value is easier to reason about when serializing to and from json.

View Source
const MatchAllUnAnchoredPattern = ".*"

MatchAllUnAnchoredPattern is the same as MatchAllAnchoredPattern, except that it can be or-ed (joined with "|") with other rules, and still match all rules.

Variables

This section is empty.

Functions

func Sanitize

func Sanitize(pattern string) string

Sanitize canonicalized the pattern for use by ToAnchoredRegexp

func ToAnchoredRegexp

func ToAnchoredRegexp(pattern string) string

ToAnchoredRegexp converts a MatchPattern field into a regexp string. It does not validate the pattern. It also adds anchors to ensure it match the whole string. It supports: * to select 0 or more DNS valid characters

func ToUnAnchoredRegexp

func ToUnAnchoredRegexp(pattern string) string

ToUnAnchoredRegexp converts a MatchPattern field into a regexp string. It does not validate the pattern. It does not add regexp anchors. It supports: * to select 0 or more DNS valid characters

func Validate

func Validate(pattern string) (matcher *regexp.Regexp, err error)

Validate ensures that pattern is a parseable matchPattern. It returns the regexp generated when validating.

func ValidateWithoutCache

func ValidateWithoutCache(pattern string) (matcher *regexp.Regexp, err error)

ValidateWithoutCache is the same as Validate() but doesn't consult the regex LRU.

Types

This section is empty.

Jump to

Keyboard shortcuts

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