v.io: v.io/v23/glob Index | Files

package glob

import "v.io/v23/glob"

Package glob defines a globbing syntax and implements matching routines.

Globs match a slash separated series of glob expressions.

// Patterns:
term ['/' term]*
term:
'*'         matches any sequence of non-Separator characters
'?'         matches any single non-Separator character
'[' [ '^' ] { character-range } ']'
// Character classes (must be non-empty):
c           matches character c (c != '*', '?', '\\', '[', '/')
'\\' c      matches character c
// Character-ranges:
c           matches character c (c != '\\', '-', ']')
'\\' c      matches character c
lo '-' hi   matches character c for lo <= c <= hi

Index

Package Files

glob.go

type Element Uses

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

Element represents a single element of a glob pattern.

func (*Element) FixedPrefix Uses

func (m *Element) FixedPrefix() (string, bool)

FixedPrefix returns the unescaped fixed part of the pattern, and whether the prefix is the whole pattern. The fixed part does not contain any wildcards.

func (*Element) Match Uses

func (m *Element) Match(segment string) bool

Match returns true iff this pattern element matches the given segment.

type Glob Uses

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

Glob represents a slash separated path glob pattern.

func Parse Uses

func Parse(pattern string) (*Glob, error)

Parse returns a new Glob.

func (*Glob) Empty Uses

func (g *Glob) Empty() bool

Empty returns true if the pattern cannot match anything.

func (*Glob) Head Uses

func (g *Glob) Head() *Element

Head returns an Element for the first element of the glob pattern.

func (*Glob) Len Uses

func (g *Glob) Len() int

Len returns the number of path elements represented by the glob expression.

func (*Glob) Recursive Uses

func (g *Glob) Recursive() bool

Recursive returns true if the pattern is recursive.

func (*Glob) Restricted Uses

func (g *Glob) Restricted() bool

Restricted returns true if recursion is restricted (up to the caller to know what that means).

func (*Glob) SplitFixedElements Uses

func (g *Glob) SplitFixedElements() ([]string, *Glob)

SplitFixedElements returns the part of the glob pattern that contains only fixed elements, and the glob that follows it.

func (*Glob) String Uses

func (g *Glob) String() string

String returns the string representation of the glob pattern.

func (*Glob) Tail Uses

func (g *Glob) Tail() *Glob

Tail returns the suffix of g starting at the second element.

Package glob imports 2 packages (graph) and is imported by 41 packages. Updated 2020-06-08. Refresh now. Tools for package owners.