regex

package
v0.20.0-beta.15 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegexNameGroup      = "NAME"
	RegexNamespaceGroup = "NAMESPACE"
)

Variables

This section is empty.

Functions

func IndexBasedReplace

func IndexBasedReplace(input string, items []IndexBasedReplaceItem) string

IndexBasedReplace replaces multiple substrings in the input string with the replacement values based on the indexes in the original input string. input - string that will have parts of it replaced items - slice of IndexBasedRelaceItem(s). Only nonoverlaping index pairs are supported.

func PrepareRegex

func PrepareRegex(regex string) (*regexp.Regexp, error)

func ProcessRegex

func ProcessRegex(regex *regexp.Regexp, input string, translateFunc TranslateFunc) string

Types

type IndexBasedReplaceItem

type IndexBasedReplaceItem struct {
	StartIndex  int
	EndIndex    int
	Replacement string
}

type TranslateFunc added in v0.16.0

type TranslateFunc func(name, namespace string) types.NamespacedName

Jump to

Keyboard shortcuts

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