rext

package
v0.0.64 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Regex

type Regex interface {
	IsMatch(haystack string) bool
	MatchFirst(haystack string) (RegexMatch, bool)
	MatchAll(haystack string) []RegexMatch
	ReplaceAll(haystack string, repl string, literal bool) string
	ReplaceAllFunc(haystack string, repl func(string) string) string
	RemoveAll(haystack string) string
	GroupCount() int
}

func W

func W(rex *regexp.Regexp) Regex

type RegexMatch

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

func (RegexMatch) FullMatch

func (m RegexMatch) FullMatch() RegexMatchGroup

func (RegexMatch) GroupByIndex

func (m RegexMatch) GroupByIndex(idx int) RegexMatchGroup

GroupByIndex returns the value of a matched group (group 0 == whole match)

func (RegexMatch) GroupByName

func (m RegexMatch) GroupByName(name string) RegexMatchGroup

GroupByName returns the value of a matched group (group 0 == whole match)

func (RegexMatch) GroupCount

func (m RegexMatch) GroupCount() int

GroupCount returns the amount of groups in this match, does not count group-0 (whole match)

type RegexMatchGroup

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

func (RegexMatchGroup) End

func (g RegexMatchGroup) End() int

func (RegexMatchGroup) Length

func (g RegexMatchGroup) Length() int

func (RegexMatchGroup) Range

func (g RegexMatchGroup) Range() (int, int)

func (RegexMatchGroup) Start

func (g RegexMatchGroup) Start() int

func (RegexMatchGroup) Value

func (g RegexMatchGroup) Value() string

Jump to

Keyboard shortcuts

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