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

Function ExampleRegex_FindString

example_test.go:36–41  ·  view source on GitHub ↗

ExampleRegex_FindString demonstrates finding a match in a string.

()

Source from the content-addressed store, hash-verified

34
35// ExampleRegex_FindString demonstrates finding a match in a string.
36func ExampleRegex_FindString() {
37 re := coregex.MustCompile(`\w+@\w+\.\w+`)
38 email := re.FindString("Contact: user@example.com")
39 fmt.Println(email)
40 // Output: user@example.com
41}
42
43// ExampleRegex_FindIndex demonstrates finding match positions.
44func ExampleRegex_FindIndex() {

Callers

nothing calls this directly

Calls 2

MustCompileFunction · 0.92
FindStringMethod · 0.80

Tested by

no test coverage detected