lazyregexp

package
v0.0.0-...-a52fffe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package lazyregexp is a thin wrapper over regexp, allowing the use of global regexp variables without forcing them to be compiled at init.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCodeRe

func IsCodeRe(b string) bool

func IsEmailRe

func IsEmailRe(b string) bool

func IsIpv4Re

func IsIpv4Re(b string) bool

func IsUrlRe

func IsUrlRe(b string) bool

func TrimHtml

func TrimHtml(src string) 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

func New(str string) *Regexp

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) Find

func (r *Regexp) Find(b []byte) []byte

func (*Regexp) FindAll

func (r *Regexp) FindAll(b []byte, n int) [][]byte

func (*Regexp) FindAllIndex

func (r *Regexp) FindAllIndex(b []byte, n int) [][]int

func (*Regexp) FindAllString

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

func (*Regexp) FindAllStringSubmatch

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

func (*Regexp) FindString

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

func (*Regexp) FindStringSubmatch

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

func (*Regexp) FindStringSubmatchIndex

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

func (*Regexp) FindSubmatch

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

func (*Regexp) Match

func (r *Regexp) Match(b []byte) bool

func (*Regexp) MatchString

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

func (*Regexp) Regexp

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

func (*Regexp) ReplaceAll

func (r *Regexp) ReplaceAll(src, repl []byte) []byte

func (*Regexp) ReplaceAllLiteralString

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

func (*Regexp) ReplaceAllString

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

func (*Regexp) ReplaceAllStringFunc

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

func (*Regexp) Split

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

func (*Regexp) SubexpNames

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL