9951 explained code solutions for 126 technologies

golangHow to use capture regexp

package main
import "regexp"

func main() {
  r := regexp.MustCompile(`o(h[0-9])`)
  captures := r.FindStringSubmatch("oh2f3")
}ctrl + c
package main

default package declaration

func main() {

declare main function that will be launched automatically


create regexp object and compile given pattern


returns found capture groups from a given string


will contain list of captured values