packagemain import( "fmt" "regexp" ) funcmain(){ //regularexpressionpattern regE:=regexp.MustCompile("/oid/([\\d]+)/") //simulateasearch //firstconvertstringtobyteforFind()function searchByte:=[]byte("/oid/1/") matchSlice:=regE.Find(searchByte) fmt.Printf("%s\n",matchSlice)//iffound,returnleftmostmatch,without'abc' matchSlice2:=regE.FindAll(searchByte,500) fmt.Printf("%s\n",matchSlice2)//iffound,returnallsuccessivematches oid:=regE.NumSubexp() fmt.Printf("OIdis%d\n",oid) //thisishowtosearchbystring matchSlice3:=regE.FindAllString(string(searchByte),-1) fmt.Printf("%s\n",matchSlice3)//iffound,returnallsuccessivematches }