Golang regexp.Match() function example

package regexp

Golang regexp.Match() function usage example

 package main

 import (
  "fmt"
  "regexp"
 )

 func main() {

  // regular expression pattern
  match, err := regexp.Match("/oid/([\\d]+)/", []byte("/oid/1/"))

  if err != nil {
 fmt.Println(err)
  }

  fmt.Println("Matched ? : ", match)

 }

Output :

Matched ? : true

Reference :

http://golang.org/pkg/regexp/#Match

Advertisement