Regexp.Find in Go

Posted by GoDoc
Public (Editable by Users)

Find returns a slice holding the text of the leftmost match in b of the regular expression. A return value of nil indicates no match.

Go
Edit
package main

import (
	"fmt"
	"regexp"
)

func main() {
	re := regexp.MustCompile(`foo.?`)
	fmt.Printf("%q\n", re.Find([]byte(`seafood fool`)))
}