query

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTMLQuery

func HTMLQuery(input string, selector string, attr string) ([]string, error)

HTMLQuery queries an HTML document using a CSS selector. If attr is non-empty, it extracts that attribute from matched elements. Otherwise it extracts text content.

func JSONPathQuery

func JSONPathQuery(input []byte, query string) ([]byte, error)

func RegexReplace

func RegexReplace(input, pattern, replacement string) (string, error)

Types

type Match

type Match struct {
	Value  string   `json:"value"`
	Start  int      `json:"start"`
	End    int      `json:"end"`
	Groups []string `json:"groups,omitempty"`
}

Match represents a single regex match.

type RegexResult

type RegexResult struct {
	Matched bool    `json:"matched"`
	Matches []Match `json:"matches"`
}

RegexResult holds the result of a regex test.

func RegexTest

func RegexTest(input, pattern string, global bool) (*RegexResult, error)

Jump to

Keyboard shortcuts

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