package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`auth-sender:\h+(.+)\h*\R*`)
var str = ` Received: from mail pickup service by fakeserver.m2w.com with Microsoft
SMTPSVC; Tue, 3 Dec 2019 14:36:35 -0800
auth-sender: santaana@fakeemail.com
Received: from 217.165.33.125 unverified ([217.165.33.125]) by
mmmeb08oc.m2w.com with M2W SMTP Server;
Tue, 03 Dec 2019 14:36:34 -0800
Date: Wed, 04 Dec 2019 02:32:18 +0400
From: "Coordinador MLV" <santaana@fakeemail.com>
To: <8736c321fd7cc61b92396b4f275614c7@fakeemail.comm>`
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/