9951 explained code solutions for 126 technologies


golangHow to use regexp


package main
import "regexp"

func main() {
  mtch, _ := regexp.MatchString(`oh[0-9]`, "oh2f3")
  print(mtch)
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically

regexp.MatchString(

match given string with a given pattern

mtch

will contain true if regexp matches