lazyregexp

Imports

Imports #

"os"
"regexp"
"strings"
"sync"

Constants & Variables

inTest var #

var inTest = *ast.BinaryExpr

Structs

Regexp struct #

Regexp is a wrapper around [regexp.Regexp], where the underlying regexp will be compiled the first time it is needed.

type Regexp struct {
str string
once sync.Once
rx *regexp.Regexp
}

Functions

FindAllString method #

func (r *Regexp) FindAllString(s string, n int) []string

FindString method #

func (r *Regexp) FindString(s string) string

FindStringSubmatch method #

func (r *Regexp) FindStringSubmatch(s string) []string

FindStringSubmatchIndex method #

func (r *Regexp) FindStringSubmatchIndex(s string) []int

FindSubmatch method #

func (r *Regexp) FindSubmatch(s []byte) [][]byte

MatchString method #

func (r *Regexp) MatchString(s string) bool

New function #

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 New(str string) *Regexp

ReplaceAllString method #

func (r *Regexp) ReplaceAllString(src string, repl string) string

SubexpNames method #

func (r *Regexp) SubexpNames() []string

build method #

func (r *Regexp) build()

re method #

func (r *Regexp) re() *regexp.Regexp

Generated with Arrow