package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^([a-zA-Z0-9]+)\s{1}[a-zA-Z0-9\.\s]+Ksh([0-9,.]+)\sfrom\s([a-zA-Z0-9\.\s]+)\son\s([0-9/]+)\sat\s([0-9:]+)\s[A|P]M\s.*$`)
var str = `PF56S55yy Confirmed.You have received Ksh6,495.00 from Guaranty Trust Bank Limited 910201 on 5/6/21 at 10:07 PM New M-PESA balance is Ksh10,103.45. Separate personal and business funds through dummytext la dummytext on *377#.`
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/