package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^(?P<unit_type>SFE)(?P<unit_size>100|80|63|50|40|32|25)(?P<mounting_type>P|Z)(?P<decompression_feature>0)(?P<sep_1>-)(?P<unit_series>1X)(?P<sep_2>/)(?P<seal_material>M)(?P<additional_details>(.|[0-9])*)$`)
var str = `SFE50Z0-1X/M
SFE32P0-1X/M
SFE32Z0-1X/M
SFE25Z0-1X/M
SFE50P0-1X/M
SFE40P0-1X/M
SFE63P0-1X/M
SFE63Z0-1X/M
SFE80Z0-1X/M
SFE40Z0-1X/M
SFE25P0-1X/M
SFE100Z0-1X/M
SFE80P0-1X/M
SFE100P0-1X/M
`
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/