Documentation ¶
Overview ¶
Package regexp implmenets API of Go's native "regexp" but with caching results in memory
Index ¶
- func Match(pattern string, b []byte) (matched bool, err error)
- func MatchString(pattern string, s string) (matched bool, err error)
- func QuoteMeta(s string) string
- func ResetCache(ttl time.Duration, isEnabled bool)
- type Regexp
- func (re *Regexp) Copy() *Regexp
- func (re *Regexp) Expand(dst []byte, template []byte, src []byte, match []int) []byte
- func (re *Regexp) ExpandString(dst []byte, template string, src string, match []int) []byte
- func (re *Regexp) Find(b []byte) []byte
- func (re *Regexp) FindAll(b []byte, n int) [][]byte
- func (re *Regexp) FindAllIndex(b []byte, n int) [][]int
- func (re *Regexp) FindAllString(s string, n int) []string
- func (re *Regexp) FindAllStringIndex(s string, n int) [][]int
- func (re *Regexp) FindAllStringSubmatch(s string, n int) [][]string
- func (re *Regexp) FindAllStringSubmatchIndex(s string, n int) [][]int
- func (re *Regexp) FindAllSubmatch(b []byte, n int) [][][]byte
- func (re *Regexp) FindAllSubmatchIndex(b []byte, n int) [][]int
- func (re *Regexp) FindIndex(b []byte) (loc []int)
- func (re *Regexp) FindReaderIndex(r io.RuneReader) (loc []int)
- func (re *Regexp) FindReaderSubmatchIndex(r io.RuneReader) []int
- func (re *Regexp) FindString(s string) string
- func (re *Regexp) FindStringIndex(s string) (loc []int)
- func (re *Regexp) FindStringSubmatch(s string) []string
- func (re *Regexp) FindStringSubmatchIndex(s string) []int
- func (re *Regexp) FindSubmatch(b []byte) [][]byte
- func (re *Regexp) FindSubmatchIndex(b []byte) []int
- func (re *Regexp) LiteralPrefix() (prefix string, complete bool)
- func (re *Regexp) Longest()
- func (re *Regexp) Match(b []byte) bool
- func (re *Regexp) MatchReader(r io.RuneReader) bool
- func (re *Regexp) MatchString(s string) bool
- func (re *Regexp) NumSubexp() int
- func (re *Regexp) ReplaceAll(src, repl []byte) []byte
- func (re *Regexp) ReplaceAllFunc(src []byte, repl func([]byte) []byte) []byte
- func (re *Regexp) ReplaceAllLiteral(src, repl []byte) []byte
- func (re *Regexp) ReplaceAllLiteralString(src, repl string) string
- func (re *Regexp) ReplaceAllString(src, repl string) string
- func (re *Regexp) ReplaceAllStringFunc(src string, repl func(string) string) string
- func (re *Regexp) Split(s string, n int) []string
- func (re *Regexp) String() string
- func (re *Regexp) SubexpNames() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchString ¶
MatchString is the same as regexp.MatchString but returns cached result instead.
func ResetCache ¶
ResetCache resets cache to initial state
Types ¶
type Regexp ¶
Regexp is a wrapper around regexp.Regexp but with caching
func CompilePOSIX ¶
CompilePOSIX does the same as regexp.CompilePOSIX but returns cached *Regexp instead.
func MustCompile ¶
MustCompile is the same as regexp.MustCompile but returns cached *Regexp instead.
func MustCompilePOSIX ¶
MustCompilePOSIX is the same as regexp.MustCompilePOSIX but returns cached *Regexp instead.
func (*Regexp) Copy ¶
Copy returns a new Regexp object copied from re.
When using a Regexp in multiple goroutines, giving each goroutine its own copy helps to avoid lock contention.
func (*Regexp) Expand ¶
Expand is the same as regexp.Regexp.Expand but returns cached result instead.
func (*Regexp) ExpandString ¶
ExpandString is the same as regexp.Regexp.ExpandString but returns cached result instead.
func (*Regexp) FindAll ¶
FindAll is the same as regexp.Regexp.FindAll but returns cached result instead.
func (*Regexp) FindAllIndex ¶
FindAllIndex is the same as regexp.Regexp.FindAllIndex but returns cached result instead.
func (*Regexp) FindAllString ¶
FindAllString is the same as regexp.Regexp.FindAllString but returns cached result instead.
func (*Regexp) FindAllStringIndex ¶
FindAllStringIndex is the same as regexp.Regexp.FindAllStringIndex but returns cached result instead.
func (*Regexp) FindAllStringSubmatch ¶
FindAllStringSubmatch is the same as regexp.Regexp.FindAllStringSubmatch but returns cached result instead.
func (*Regexp) FindAllStringSubmatchIndex ¶
FindAllStringSubmatchIndex is the same as regexp.Regexp.FindAllStringSubmatchIndex but returns cached result instead.
func (*Regexp) FindAllSubmatch ¶
FindAllSubmatch is the same as regexp.Regexp.FindAllSubmatch but returns cached result instead.
func (*Regexp) FindAllSubmatchIndex ¶
FindAllSubmatchIndex is the same as regexp.Regexp.FindAllSubmatchIndex but returns cached result instead.
func (*Regexp) FindIndex ¶
FindIndex is the same as regexp.Regexp.FindIndex but returns cached result instead.
func (*Regexp) FindReaderIndex ¶
func (re *Regexp) FindReaderIndex(r io.RuneReader) (loc []int)
FindReaderIndex is the same as regexp.Regexp.FindReaderIndex (NO CACHE).
func (*Regexp) FindReaderSubmatchIndex ¶
func (re *Regexp) FindReaderSubmatchIndex(r io.RuneReader) []int
FindReaderSubmatchIndex is the same as regexp.Regexp.FindReaderSubmatchIndex (NO CACHE).
func (*Regexp) FindString ¶
FindString is the same as regexp.Regexp.FindString but returns cached result instead.
func (*Regexp) FindStringIndex ¶
FindStringIndex is the same as regexp.Regexp.FindStringIndex but returns cached result instead.
func (*Regexp) FindStringSubmatch ¶
FindStringSubmatch is the same as regexp.Regexp.FindStringSubmatch but returns cached result instead.
func (*Regexp) FindStringSubmatchIndex ¶
FindStringSubmatchIndex is the same as regexp.Regexp.FindStringSubmatchIndex but returns cached result instead.
func (*Regexp) FindSubmatch ¶
FindSubmatch is the same as regexp.Regexp.FindSubmatch but returns cached result instead.
func (*Regexp) FindSubmatchIndex ¶
FindSubmatchIndex is the same as regexp.Regexp.FindSubmatchIndex but returns cached result instead.
func (*Regexp) LiteralPrefix ¶
LiteralPrefix returns a literal string that must begin any match Calls regexp.Regexp.LiteralPrefix
func (*Regexp) Longest ¶
func (re *Regexp) Longest()
Longest calls regexp.Regexp.Longest of wrapped regular expression
func (*Regexp) MatchReader ¶
func (re *Regexp) MatchReader(r io.RuneReader) bool
MatchReader reports whether the Regexp matches the text read by the RuneReader. Calls regexp.Regexp.MatchReader (NO CACHE)
func (*Regexp) MatchString ¶
MatchString reports whether the Regexp matches the string s.
func (*Regexp) NumSubexp ¶
NumSubexp returns result of regexp.Regexp.NumSubexp of wrapped regular expression.
func (*Regexp) ReplaceAll ¶
ReplaceAll is the same as regexp.Regexp.ReplaceAll but returns cached result instead.
func (*Regexp) ReplaceAllFunc ¶
ReplaceAllFunc is the same as regexp.Regexp.ReplaceAllFunc but returns cached result instead.
func (*Regexp) ReplaceAllLiteral ¶
ReplaceAllLiteral is the same as regexp.Regexp.ReplaceAllLiteral but returns cached result instead.
func (*Regexp) ReplaceAllLiteralString ¶
ReplaceAllLiteralString is the same as regexp.Regexp.ReplaceAllLiteralString but returns cached result instead.
func (*Regexp) ReplaceAllString ¶
ReplaceAllString is the same as regexp.Regexp.ReplaceAllString but returns cached result instead.
func (*Regexp) ReplaceAllStringFunc ¶
ReplaceAllStringFunc is the same as regexp.Regexp.ReplaceAllStringFunc but returns cached result instead.
func (*Regexp) String ¶
String returns the source text used to compile the wrapped regular expression.
func (*Regexp) SubexpNames ¶
SubexpNames returns result of regexp.Regexp.SubexpNames of wrapped regular expression.