package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`Manufacturer:\s(?<Manufacturer>.*)`)
var str = `002446fffd003274.2:
Label: Back Door Lock
Manufacturer: Kwikset
Model: SMARTCODE_DEADBOLT_5
Firmware version: 0x3071cb06
Hardware version: 3
User Properties:
NearEndRssi: -41
NearEndLqi: 243
label: Back Door Lock
deadboltJammed: false
Battery Operated: True
Voltage: 5.8V
FE radio: -67/254
NE radio: -41/243
Date added: Thu Oct 27 08:02:42 CDT 2016
Date of last communication: Mon Feb 13 14:15:14 CST 2017
In Communication Failure: false
In firmware upgrade failure: false
Firmware upgrade available: false
Is Locked: true
Max Users: 30
Operation Mode: normal`
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/