package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(\s|\S){0,40}\"([0-9]{1,3})\"\;\}`)
var str = `a:1:{s:2:"gr";s:3:"214";}
a:1:{s:2:"gr";s:3:"188";}
a:1:{s:2:"gr";s:3:"213";}
a:1:{s:2:"gr";s:3:"169";}
a:1:{s:2:"gr";s:3:"219";}
a:1:{s:2:"gr";s:3:"221";}
a:1:{s:2:"gr";s:3:"211";}
a:1:{s:2:"gr";s:3:"184";}
a:1:{s:2:"gr";s:3:"191";}
a:1:{s:2:"gr";s:2:"16";}
a:1:{s:2:"gr";s:3:"127";}
a:1:{s:2:"gr";s:3:"217";}
a:1:{s:2:"gr";s:3:"200";}
a:1:{s:2:"gr";s:3:"182";}
a:1:{s:2:"gr";s:3:"128";}
a:1:{s:2:"gr";s:2:"17";}
a:1:{s:2:"gr";s:3:"163";}
a:1:{s:2:"gr";s:3:"212";}
a:1:{s:2:"gr";s:3:"166";}
a:1:{s:2:"gr";s:2:"94";}
a:1:{s:2:"gr";s:2:"83";}
a:1:{s:2:"gr";s:2:"27";}
a:1:{s:2:"gr";s:2:"28";}
a:1:{s:2:"gr";s:3:"167";}
a:1:{s:2:"gr";s:3:"168";}
a:1:{s:2:"gr";s:3:"202";}
a:1:{s:2:"gr";s:1:"7";}
a:1:{s:2:"gr";s:3:"129";}
a:1:{s:2:"gr";s:3:"183";}
a:1:{s:2:"gr";s:2:"26";}
a:1:{s:2:"gr";s:3:"185";}
a:1:{s:2:"gr";s:3:"175";}
a:1:{s:2:"gr";s:2:"29";}
a:1:{s:2:"gr";s:3:"209";}
a:1:{s:2:"gr";s:3:"177";}
a:1:{s:2:"gr";s:3:"178";}
a:1:{s:2:"gr";s:2:"24";}
a:1:{s:2:"gr";s:3:"225";}
a:1:{s:2:"gr";s:3:"224";}
a:1:{s:2:"gr";s:2:"57";}
a:1:{s:2:"gr";s:2:"18";}
a:1:{s:2:"gr";s:3:"208";}
a:1:{s:2:"gr";s:3:"193";}
a:1:{s:2:"gr";s:2:"33";}
a:1:{s:2:"gr";s:2:"10";}
a:1:{s:2:"gr";s:2:"11";}
a:1:{s:2:"gr";s:2:"12";}
a:1:{s:2:"gr";s:3:"173";}
a:1:{s:2:"gr";s:2:"13";}
a:1:{s:2:"gr";s:2:"14";}
a:1:{s:2:"gr";s:1:"9";}
a:1:{s:2:"gr";s:2:"15";}
a:1:{s:2:"gr";s:3:"195";}
a:1:{s:2:"gr";s:3:"130";}
a:1:{s:2:"gr";s:2:"25";}
a:1:{s:2:"gr";s:2:"50";}
a:1:{s:2:"gr";s:3:"131";}
a:1:{s:2:"gr";s:2:"96";}
a:1:{s:2:"gr";s:2:"19";}
a:1:{s:2:"gr";s:3:"107";}
a:1:{s:2:"gr";s:3:"116";}
a:1:{s:2:"gr";s:3:"364";}
a:1:{s:2:"gr";s:3:"194";}
a:1:{s:2:"gr";s:2:"44";}
a:1:{s:2:"gr";s:3:"171";}
a:1:{s:2:"gr";s:3:"172";}
a:1:{s:2:"gr";s:3:"170";}
a:1:{s:2:"gr";s:2:"20";}
a:1:{s:2:"gr";s:2:"95";}
a:1:{s:2:"gr";s:2:"84";}
a:1:{s:2:"gr";s:2:"22";}
a:1:{s:2:"gr";s:2:"23";}
a:1:{s:2:"gr";s:2:"67";}
a:1:{s:2:"gr";s:3:"118";}
a:1:{s:2:"gr";s:2:"97";}
a:1:{s:2:"gr";s:1:"6";}
a:1:{s:2:"gr";s:3:"365";}
a:1:{s:2:"gr";s:3:"190";}
a:1:{s:2:"gr";s:2:"82";}
a:1:{s:2:"gr";s:2:"42";}
a:1:{s:2:"gr";s:2:"74";}
a:1:{s:2:"gr";s:2:"76";}
a:1:{s:2:"gr";s:2:"73";}
a:1:{s:2:"gr";s:2:"78";}
a:1:{s:2:"gr";s:2:"68";}
a:1:{s:2:"gr";s:3:"207";}
a:1:{s:2:"gr";s:3:"197";}
a:1:{s:2:"gr";s:2:"77";}
a:1:{s:2:"gr";s:2:"46";}
a:1:{s:2:"gr";s:2:"51";}
a:1:{s:2:"gr";s:3:"206";}
a:1:{s:2:"gr";s:3:"165";}
a:1:{s:2:"gr";s:2:"60";}
a:1:{s:2:"gr";s:2:"61";}
a:1:{s:2:"gr";s:2:"62";}
a:1:{s:2:"gr";s:3:"187";}
a:1:{s:2:"gr";s:3:"176";}
a:1:{s:2:"gr";s:3:"196";}
a:1:{s:2:"gr";s:3:"223";}
a:1:{s:2:"gr";s:3:"117";}
a:1:{s:2:"gr";s:2:"98";}
a:1:{s:2:"gr";s:2:"47";}
a:1:{s:2:"gr";s:3:"198";}
a:1:{s:2:"gr";s:2:"45";}
a:1:{s:2:"gr";s:3:"203";}
a:1:{s:2:"gr";s:3:"205";}
a:1:{s:2:"gr";s:3:"201";}
a:1:{s:2:"gr";s:3:"115";}
a:1:{s:2:"gr";s:2:"58";}
a:1:{s:2:"gr";s:3:"204";}
a:1:{s:2:"gr";s:3:"132";}
a:1:{s:2:"gr";s:2:"48";}
a:1:{s:2:"gr";s:2:"49";}
a:1:{s:2:"gr";s:2:"99";}
a:1:{s:2:"gr";s:3:"594";}
a:1:{s:2:"gr";s:3:"585";}
a:1:{s:2:"gr";s:3:"368";}
a:1:{s:2:"gr";s:2:"81";}
a:1:{s:2:"gr";s:2:"53";}
a:1:{s:2:"gr";s:2:"52";}
a:1:{s:2:"gr";s:3:"180";}
a:1:{s:2:"gr";s:3:"181";}
a:1:{s:2:"gr";s:3:"179";}
a:1:{s:2:"gr";s:3:"164";}
a:1:{s:2:"gr";s:3:"186";}
a:1:{s:2:"gr";s:3:"174";}
a:1:{s:2:"gr";s:3:"199";}
a:1:{s:2:"gr";s:3:"210";}
a:1:{s:2:"gr";s:3:"369";}
a:1:{s:2:"gr";s:3:"370";}
a:1:{s:2:"gr";s:3:"371";}
a:1:{s:2:"gr";s:3:"372";}
a:1:{s:2:"gr";s:3:"373";}
a:1:{s:2:"gr";s:3:"374";}
a:1:{s:2:"gr";s:3:"375";}`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/