Source File
lazyre.go
Belonging Package
internal/lazyregexp
package lazyregexp
import (
)
type Regexp struct {
str string
once sync.Once
rx *regexp.Regexp
}
func ( *Regexp) () *regexp.Regexp {
.once.Do(.build)
return .rx
}
func ( *Regexp) () {
.rx = regexp.MustCompile(.str)
.str = ""
}
func ( *Regexp) ( []byte) [][]byte {
return .re().FindSubmatch()
}
func ( *Regexp) ( string) []string {
return .re().FindStringSubmatch()
}
func ( *Regexp) ( string) []int {
return .re().FindStringSubmatchIndex()
}
func ( *Regexp) (, string) string {
return .re().ReplaceAllString(, )
}
func ( *Regexp) ( string) string {
return .re().FindString()
}
func ( *Regexp) ( string, int) []string {
return .re().FindAllString(, )
}
func ( *Regexp) ( string) bool {
return .re().MatchString()
}
func ( *Regexp) () []string {
return .re().SubexpNames()
}
var inTest = len(os.Args) > 0 && strings.HasSuffix(strings.TrimSuffix(os.Args[0], ".exe"), ".test")
.re()
}
return
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |