regexp

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetEngine

func SetEngine(engine Engine)

SetEngine selects the regex engine used by subsequent MustCompile calls.

func Version

func Version() string

Version returns the name of the active regex engine.

Types

type Engine added in v1.1.2

type Engine interface {
	Compile(str string) (internal.CompiledRegexp, error)
	Version() string
}

type Regexp

type Regexp struct {
	// contains filtered or unexported fields
}

Regexp wraps a regular expression. Compilation is deferred until first match.

func Compile added in v1.1.0

func Compile(str string) (*Regexp, error)

Compile parses a regular expression using the currently selected engine. If successful, returns a Regexp object that can be used to match against text.

func MustCompile

func MustCompile(str string) *Regexp

MustCompile compiles a regular expression using the currently selected engine.

func (*Regexp) FindAllStringIndex

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

func (*Regexp) FindString

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

func (*Regexp) FindStringSubmatch

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

func (*Regexp) MatchString

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

func (*Regexp) NumSubexp

func (r *Regexp) NumSubexp() int

func (*Regexp) ReplaceAllString

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

func (*Regexp) String

func (r *Regexp) String() string

func (*Regexp) SubexpNames added in v1.1.0

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

type Stdlib added in v1.1.2

type Stdlib struct{}

Stdlib is an Engine that uses the standard regexp package.

func (Stdlib) Compile added in v1.1.2

func (Stdlib) Compile(str string) (internal.CompiledRegexp, error)

func (Stdlib) Version added in v1.1.2

func (Stdlib) Version() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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