package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^(?P<unit_type>SFS)(?P<unit_size>300|250|200)(?P<mounting_type>A|B)(?P<decompression_feature>0)(?P<sep_1>-)(?P<cracking_pressure>1)(?P<sep_2>-)(?P<unit_series>4X)(?P<sep_3>/)(?P<seal_material>|)(?P<additional_details>(.|[0-9])*)$`)
var str = `SFS300A0-1-4X/
SFS250A0-1-4X/
SFS200A0-1-4X/
SFS200B0-1-4X/
SFS250A0-1-4X/Q2TQ.G24
SFS250A0-1-4X/Q2TQ2G24
SFS200A0-1-4X/Q2TQ2G24
SFS300A0-1-4X/Q2TQ2G24
SFS250B0-1-4X/
`
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/