regex

package
v21.1.2+incompatible Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package regex provides a registry of precompiled regular expressions to allow reusing them without the syntactic overhead of declaring pattern variables everywhere in the code. The registry is not thread-safe, but the precompiled patterns are.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pattern

type Pattern string

type Registry

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

func NewRegistry

func NewRegistry() Registry

func (*Registry) Compile

func (r *Registry) Compile(re Pattern) *regexp.Regexp

func (*Registry) Match

func (r *Registry) Match(s string, re Pattern) []string

func (*Registry) Match1

func (r *Registry) Match1(s string, re Pattern) (matched bool, m1 string)

func (*Registry) Match2

func (r *Registry) Match2(s string, re Pattern) (matched bool, m1, m2 string)

func (*Registry) Match3

func (r *Registry) Match3(s string, re Pattern) (matched bool, m1, m2, m3 string)

func (*Registry) Matches

func (r *Registry) Matches(s string, re Pattern) bool

func (*Registry) PrintStats

func (r *Registry) PrintStats(out io.Writer)

func (*Registry) Profiling

func (r *Registry) Profiling()

func (*Registry) ReplaceFirst

func (r *Registry) ReplaceFirst(s string, re Pattern, replacement string) ([]string, string)

Jump to

Keyboard shortcuts

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