matcher

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package matcher provides wildcard-based matching for rule IDs, paths, etc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

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

Matcher represents a compiled list of string matchers with wildcard support.

func New

func New(patterns []string) *Matcher

New creates a new matcher from a list of patterns.

Supported syntax:

  • Exact match: "sql-injection"
  • Wildcard match: "sql-*", "*-injection"
  • Negation: "!deprecated-*"

func (*Matcher) AnyMatch

func (m *Matcher) AnyMatch(values []string) bool

AnyMatch reports whether at least one of the provided values matches.

func (*Matcher) Match

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

Match reports whether the given value is accepted by the matcher.

Negated patterns take precedence. If no patterns match, returns false.

func (*Matcher) MatchAll

func (m *Matcher) MatchAll(values []string) []string

MatchAll filters and returns all values that match the patterns.

Jump to

Keyboard shortcuts

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