Package regexp provides an implementation to match strings against a set of regexp string filters.



    This section is empty.


    This section is empty.


    This section is empty.


    type Config

    type Config struct {
    	// CacheEnabled determines whether match results are LRU cached to make subsequent matches faster.
    	// Cache size is unlimited unless CacheMaxNumEntries is also specified.
    	CacheEnabled bool `mapstructure:"cacheenabled"`
    	// CacheMaxNumEntries is the max number of entries of the LRU cache that stores match results.
    	// CacheMaxNumEntries is ignored if CacheEnabled is false.
    	CacheMaxNumEntries int `mapstructure:"cachemaxnumentries"`

      Config represents the options for a NewFilterSet.

      type FilterSet

      type FilterSet struct {
      	// contains filtered or unexported fields

        FilterSet encapsulates a set of filters and caches match results. Filters are re2 regex strings. FilterSet is exported for convenience, but has unexported fields and should be constructed through NewFilterSet.

        FilterSet satisfies the FilterSet interface from ""

        func NewFilterSet

        func NewFilterSet(filters []string, cfg *Config) (*FilterSet, error)

          NewFilterSet constructs a FilterSet of re2 regex strings. If any of the given filters fail to compile into re2, an error is returned.

          func (*FilterSet) Matches

          func (rfs *FilterSet) Matches(toMatch string) bool

            Matches returns true if the given string matches any of the FilterSet's filters. The given string must be fully matched by at least one filter's re2 regex.