regexp

package
v0.1.0-dev.20260311211644 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package regexp provides regular expression operations for the operation graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	op.ProviderBase
	// contains filtered or unexported fields
}

Provider provides regular expression operations with compiled pattern caching. +devlore:access=both

func (*Provider) Find

func (p *Provider) Find(pattern, text string) (string, error)

Find returns the first match of the pattern in the text. Returns an empty string if no match is found.

func (*Provider) FindAll

func (p *Provider) FindAll(pattern, text string, count int) ([]string, error)

FindAll returns all non-overlapping matches of the pattern. The count parameter limits the number of matches; -1 means no limit.

func (*Provider) FindAllSubmatch

func (p *Provider) FindAllSubmatch(pattern, text string, count int) ([][]string, error)

FindAllSubmatch returns all matches with their submatches. The count parameter limits the number of matches; -1 means no limit.

func (*Provider) FindSubmatch

func (p *Provider) FindSubmatch(pattern, text string) ([]string, error)

FindSubmatch returns the first match and its submatches. Returns nil if no match is found.

func (*Provider) Match

func (p *Provider) Match(pattern, text string) (bool, error)

Match reports whether the text contains any match of the pattern.

func (*Provider) Replace

func (p *Provider) Replace(pattern, text, replacement string) (string, error)

Replace replaces all matches of the pattern with the replacement string. The replacement can include $1, $2, etc. for submatch references.

func (*Provider) ReplaceLiteral

func (p *Provider) ReplaceLiteral(pattern, text, replacement string) (string, error)

ReplaceLiteral replaces all matches with the literal replacement string (no submatch expansion).

func (*Provider) Split

func (p *Provider) Split(pattern, text string, count int) ([]string, error)

Split splits the text around matches of the pattern. The count parameter limits the number of substrings; -1 means no limit.

Jump to

Keyboard shortcuts

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