package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?i)\s+From: F3[\w\W]+`)
var str = `PS – extra nice work on this one! 😊
Thank you !
From: F3 test <test@test.com>
Sent: Thursday, October 3, 2024 4:13 PM
To: test <test@test.com>
Subject: Re: Question
Good afternoon,`
if len(re.FindStringIndex(str)) > 0 {
fmt.Println(re.FindString(str),"found at index",re.FindStringIndex(str)[0])
}
}
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/