MCPcopy Create free account
hub / github.com/coregx/coregex / ExampleRegex_Find

Function ExampleRegex_Find

example_test.go:28–33  ·  view source on GitHub ↗

ExampleRegex_Find demonstrates finding the first match.

()

Source from the content-addressed store, hash-verified

26
27// ExampleRegex_Find demonstrates finding the first match.
28func ExampleRegex_Find() {
29 re := coregex.MustCompile(`\d+`)
30 match := re.Find([]byte("age: 42 years"))
31 fmt.Println(string(match))
32 // Output: 42
33}
34
35// ExampleRegex_FindString demonstrates finding a match in a string.
36func ExampleRegex_FindString() {

Callers

nothing calls this directly

Calls 2

MustCompileFunction · 0.92
FindMethod · 0.65

Tested by

no test coverage detected