package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)filter.........([^"]*)`)
var str = `{
"bridge": {
"name": "Homebridge",
"username": "XX:22:3D:XX:CE:31",
"port": 51826,
"pin": "031-45-154"
},
"platforms": [
{
"platform": "FHEM",
"name": "FHEM",
"server": "127.0.0.1",
"port": "8083",
"auth": {"user": "Bernd", "pass": "xxxxx"},
"filter": "room=Homekit"
}
],
"accessories": []
}`
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/