package lazyregexp
import "golang.org/x/mod/internal/lazyregexp"
Package lazyregexp is a thin wrapper over regexp, allowing the use of global regexp variables without forcing them to be compiled at init.
Index ¶
- type Regexp
- func New(str string) *Regexp
- func (r *Regexp) FindAllString(s string, n int) []string
- func (r *Regexp) FindString(s string) string
- func (r *Regexp) FindStringSubmatch(s string) []string
- func (r *Regexp) FindStringSubmatchIndex(s string) []int
- func (r *Regexp) FindSubmatch(s []byte) [][]byte
- func (r *Regexp) MatchString(s string) bool
- func (r *Regexp) ReplaceAllString(src, repl string) string
- func (r *Regexp) SubexpNames() []string
Types ¶
type Regexp ¶
type Regexp struct {
// contains filtered or unexported fields
}
Regexp is a wrapper around regexp.Regexp, where the underlying regexp will be compiled the first time it is needed.
func New ¶
New creates a new lazy regexp, delaying the compiling work until it is first needed. If the code is being run as part of tests, the regexp compiling will happen immediately.
func (*Regexp) FindAllString ¶
func (*Regexp) FindString ¶
func (*Regexp) FindStringSubmatch ¶
func (*Regexp) FindStringSubmatchIndex ¶
func (*Regexp) FindSubmatch ¶
func (*Regexp) MatchString ¶
func (*Regexp) ReplaceAllString ¶
func (*Regexp) SubexpNames ¶
Source Files ¶
lazyre.go
- Version
- v0.23.0 (latest)
- Published
- Feb 3, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 4 days ago –
Tools for package owners.