MCPcopy Create free account
hub / github.com/docker/secrets-engine / ParsePattern

Function ParsePattern

x/secrets/pattern.go:124–129  ·  view source on GitHub ↗

ParsePattern parses a string into a [Pattern] Rules: - Components separated by '/' - Each component is non-empty - Only characters A-Z, a-z, 0-9, '.', '-', '_' or '*' - No leading, trailing, or double slashes - Asterisks rules: - '*' cannot be mixed with other characters in the same component - ther

(s string)

Source from the content-addressed store, hash-verified

122// - '*' cannot be mixed with other characters in the same component
123// - there can be no more than two '*' per component
124func ParsePattern(s string) (Pattern, error) {
125 if !validPattern(s) {
126 return nil, ErrInvalidPattern
127 }
128 return pattern(s), nil
129}
130
131// MustParsePattern parses a string into a [Pattern] like with [ParsePattern],
132// however, it panics when a validation error occurs.

Callers 3

TestMatchNewFunction · 0.85
TestParsePatternFunction · 0.85
TestPatternIncludesFunction · 0.85

Calls 2

validPatternFunction · 0.85
patternTypeAlias · 0.85

Tested by 3

TestMatchNewFunction · 0.68
TestParsePatternFunction · 0.68
TestPatternIncludesFunction · 0.68