regexp

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: MIT Imports: 4 Imported by: 2

Documentation

Overview

Package regexp ports Go's regexp package to google/go-jsonnet's native functions.

Example
vm := jsonnet.MakeVM()
vm.NativeFunction(regexp.MatchString("regexp.match"))
code := `std.native("regexp.match")("l{2}", "hello")`
result, err := vm.EvaluateAnonymousSnippet("test.jsonnet", code)
if err != nil {
	log.Fatal(err)
}
var a []any
if err := json.Unmarshal([]byte(result), &a); err != nil {
	log.Fatal(err)
}
fmt.Printf("%v %v\n", a[0], a[1])
Output:

true <nil>

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchString

func MatchString(name string) *jsonnet.NativeFunction

Types

This section is empty.

Jump to

Keyboard shortcuts

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