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 :
Advertisement
Something interesting
Tutorials
+34k Golang : Proper way to set function argument default value
+13.2k Golang : How to calculate the distance between two coordinates using Haversine formula
+21.2k Golang : How to get time zone and load different time zone?
+12.1k Golang : Perform sanity checks on filename example
+28.5k Golang : Change a file last modified date and time
+5k Golang : Get a list of crosses(instruments) available to trade from Oanda account
+22.9k Golang : Gorilla mux routing example
+5.8k Golang : List all packages and search for certain package
+6.8k Golang : Muxing with Martini example
+9.7k Golang : Eroding and dilating image with OpenCV example
+26.1k Mac/Linux and Golang : Fix bind: address already in use error
+6.1k Golang : Build new URL for named or registered route with Gorilla webtoolkit example