package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`^(?s).*Subject:(?<identificationValue>ST[0-9]*)\.\d*\.\d*\.(?<identifier>[0-9]*).*Text: (?<remark>.*)Code:.*$`)
var str = `From:stoerungen@fe-trading.at
Subject:ST412.3.3.28 [RCT/28]: Kartenleserfehler, bitte pruefen!
Send date:Mon May 08 13:28:51 CET 2017
Content type:text/plain; charset="iso-8859-1"
System: RCT/FAULT (08.05.2017 13:28:51)
Station: ST412, 4846 Redlham, Gewerbepark Ost 27
Text: Kartenleserfehler, bitte pruefen!
Gruppe: 3
Device: 3
Code: 28`
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/