package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`^(?:(?!.*LT circa).+\n)*(?:(?!LT circa).)*LT circa\s+(\d\d\.\d\d.\d{4})(?!(?:.+\n)*.*LT circa)`)
var str = `Metall-Notierung 464,95 EUR 100 KG
* LT circa 21.04.2020 2 x 500 M Einwegtrommel 400x 150x 404mm
* LT circa 17.05.2020 2 x 500 M Einwegtrommel 400x 150x 404mm
Zolltarifnummer 80464995`
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/