package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`\w\s(?P<type>\S+)\s(?P<name>\S+)\s(?P<model>\S+)\s(?P<code>\S+)\s(?P<serial_number>\S+)\s(?P<in_charge>\S+\s\S+\s\S+)`)
var str = `X Маршрутизатор Cisco 892FSР
00206760
FGL174121B4
Иванов Иван Иванович
4 Маршрутизатор Huawei HYFSР23
00216760
2FGL174121B4
Петров Петр Петррович
`
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/