package main import ( "fmt" "regexp" ) func main() { pattern := "(Hello) (World)" inputData := "Hello World" regex := regexp.MustCompile(pattern) submatches := regex.FindSubmatch([]byte(inputData)) if len(submatches) > 0 { fmt.Println(string(submatches[0])) fmt.Println(string(submatches[1])) fmt.Println(string(submatches[2])) } }In this example, the regex pattern matches "Hello World" string, which consists of two submatches - "Hello" and "World". The matching result is printed out in lines 10-12. The package library for Go regexp is "regexp".