Literals in Regular Expression

Literals are the simplest form of pattern matching in regular expressions. They will simply succeed whenever that literal is found.

func Match 

func Match(pattern string, b []byte) (matched bool, err error)

Match reports whether the byte slice b contains any match of the regular expression pattern.

Example Code

package main

import (

func main() {
        // Match() function return a boolean type value 
        // with boolean it limit us from extracting the match string value
	matched, err := regexp.Match(pattern, []byte(`World Hello`))
	// print value return from Match() func
	fmt.Println(matched, err)
	if matched {
	} else {
	   fmt.Println("Not Found")

Go Playground


go doc regexp/syntax