Documentation
¶
Index ¶
- Constants
- func Match(input, pattern string) (bool, error)
- func MatchLongestPrefix(input, pattern string) (int, bool, error)
- func MatchLongestSuffix(input, pattern string) (int, bool, error)
- func MatchPrefix(input, pattern string, flags int) (int, bool, error)
- func MatchShortestPrefix(input, pattern string) (int, bool, error)
- func MatchShortestSuffix(input, pattern string) (int, bool, error)
- func MatchSuffix(input, pattern string, flags int) (int, bool, error)
- type Glob
- func (g *Glob) Match(input string) (bool, error)
- func (g *Glob) MatchLongestPrefix(input string) (int, bool, error)
- func (g *Glob) MatchLongestSuffix(input string) (int, bool, error)
- func (g *Glob) MatchShortestPrefix(input string) (int, bool, error)
- func (g *Glob) MatchShortestSuffix(input string) (int, bool, error)
- func (g Glob) Pattern() string
Constants ¶
const ( // GlobShortestMatch makes wildcards match the minimum number of // characters possible GlobShortestMatch = 0 // GlobLongestMatch makes wildcards match the maximum number of // characters possible GlobLongestMatch = 1 // GlobAnchorPrefix makes the glob pattern match from the start // of your input string GlobAnchorPrefix = 2 // GlobAnchorSuffix makes the glob pattern match up to the end // of your input string GlobAnchorSuffix = 4 )
const GlobMatchWholeString = GlobAnchorPrefix + GlobAnchorSuffix
GlobMatchWholeString makes the glob pattern apply to all of your input string
Variables ¶
This section is empty.
Functions ¶
func Match ¶
Match determines if the whole input string matches the given glob pattern.
Pattern can be built from:
- Matches zero or more characters ? Matches exactly one character [...] Matches any one character within the brackets
any other character matches itself
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
func MatchLongestPrefix ¶
MatchLongestPrefix returns the prefix of input that matches the glob pattern. It treats '*' as matching maximum number of characters.
Pattern can be built from:
- Matches zero or more characters ? Matches exactly one character [...] Matches any one character within the brackets
any other character matches itself
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
Returns - length of prefix that matches, or zero otherwise - `true` if the input has prefix tath matched the pattern
func MatchLongestSuffix ¶
MatchLongestSuffix returns the suffix of input that matches the glob pattern. It treats '*' as matching maximum number of characters.
Pattern can be built from:
- Matches zero or more characters ? Matches exactly one character [...] Matches any one character within the brackets
any other character matches itself
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
Returns - start of suffix that matches (can be len(input)), or zero otherwise - `true` if the input has suffix that matched the pattern
func MatchPrefix ¶
MatchPrefix returns the prefix of input that matches the glob pattern
Pattern can be built from:
- Matches zero or more characters ? Matches exactly one character [...] Matches any one character within the brackets
any other character matches itself
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
flags can be: - GlobShortestMatch (default) - GlobLongestMatch
Returns - length of prefix that matches, or zero otherwise - `true` if the input has prefix that matched the pattern
func MatchShortestPrefix ¶
MatchShortestPrefix returns the prefix of input that matches the glob pattern. It treats '*' as matching minimum number of characters.
Pattern can be built from:
- Matches zero or more characters ? Matches exactly one character [...] Matches any one character within the brackets
any other character matches itself
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
Returns - length of prefix that matches, or zero otherwise - `true` if the input has prefix that matched the pattern
func MatchShortestSuffix ¶
MatchShortestSuffix returns the suffix of input that matches the glob pattern. It treats '*' as matching minimum number of characters.
Pattern can be built from:
- Matches zero or more characters ? Matches exactly one character [...] Matches any one character within the brackets
any other character matches itself
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
It is computationally more expensive than the other MatchXXX() functions, due to Golang's leftmost-match mechanics (which we have to compensate for).
Returns - start of suffix that matches (can be len(input)), or zero otherwise - `true` if the input has suffix that matched the pattern
func MatchSuffix ¶
MatchSuffix returns the start of input that matches the glob pattern.
Pattern can be built from:
- Matches zero or more characters ? Matches exactly one character [...] Matches any one character within the brackets
any other character matches itself
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
flags can be: - GlobShortestMatch (default) - GlobLongestMatch
Returns - start of suffix that matches (can be len(input)), or zero otherwise - `true` if the input has suffix that matched the pattern
Types ¶
type Glob ¶
type Glob struct {
// contains filtered or unexported fields
}
Glob is a compiled Glob expression, which can safely be reused.
Call `NewGlob()` to create your Glob structure
func (*Glob) Match ¶
Match determines if the whole input string matches the given glob pattern.
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
func (*Glob) MatchLongestPrefix ¶
MatchLongestPrefix returns the prefix of input that matches the glob pattern. It treats '*' as matching maximum number of characters.
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
Returns - length of prefix that matches, or zero otherwise - `true` if the input has prefix tath matched the pattern
func (*Glob) MatchLongestSuffix ¶
MatchLongestSuffix returns the suffix of input that matches the glob pattern. It treats '*' as matching maximum number of characters.
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
Returns - start of suffix that matches (can be len(input)), or zero otherwise - `true` if the input has suffix that matched the pattern
func (*Glob) MatchShortestPrefix ¶
MatchShortestPrefix returns the prefix of input that matches the glob pattern. It treats '*' as matching minimum number of characters.
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
Returns - length of prefix that matches, or zero otherwise - `true` if the input has prefix that matched the pattern
func (*Glob) MatchShortestSuffix ¶
MatchShortestSuffix returns the suffix of input that matches the glob pattern. It treats '*' as matching minimum number of characters.
Intent is to be 100% compatible with UNIX shell globbing. Please open a GitHub issue if you find any test cases that show up compatibility problems.
It is computationally more expensive than the other MatchXXX() functions, due to Golang's leftmost-match mechanics (which we have to compensate for).
Returns - start of suffix that matches (can be len(input)), or zero otherwise - `true` if the input has suffix that matched the pattern