wildcard

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package wildcard provides a fast, zero-allocation wildcard matcher.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CaseSensitivity

type CaseSensitivity bool

CaseSensitivity controls the case sensitivity of matching.

const (
	CaseSensitive   CaseSensitivity = true
	CaseInsensitive CaseSensitivity = false
)

CaseSensitivity values.

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

Matcher matches strings against a wildcard pattern with configurable case sensitivity.

func NewMatcher

func NewMatcher(p string, caseSensitive CaseSensitivity) *Matcher

NewMatcher constructs a new wildcard matcher for the given pattern.

If p is the empty string, it will match only the empty string. If p is not a valid UTF-8 string, matching behaviour is undefined.

func (*Matcher) Match

func (m *Matcher) Match(s string) bool

Match reports whether s matches m's wildcard pattern.

type Matchers

type Matchers []*Matcher

Matchers is a slice of Matcher, matching any of the contained matchers.

func (Matchers) MatchAny

func (m Matchers) MatchAny(s string) bool

MatchAny returns true iff any of the matchers returns true.

Jump to

Keyboard shortcuts

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