package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?:Product (\d{6})(\d{8}) (.{12}) (.+)\s?\*BCA)+`)
var str = `Account balance PLM051 05May2016 10:54
Actions Submenu View authorisation balance details
View available balance detailsExit
Product 40256731631234 BUSINESS A/C Zapp Innovat*BCA
Balances as at 05May2016 10:54 except where indicated
Balance 907.50Cr
Statement balance 1,059.50Cr (04May2016)
Cleared balance 907.50Cr
Interest balance 1,059.50Cr (04May2016)
Available balance 793.56Cr
Authorisation balance 793.56Cr
Other details
Account balance PLM051 05May2016 10:54
Actions Submenu View authorisation balance details
View available balance detailsExit
Product 40256731631234 BUSINESS A/C Zapp Innovat*BCA
Balances as at 05May2016 10:54 except where indicated
Balance 907.50Cr
Statement balance 1,059.50Cr (04May2016)
Cleared balance 907.50Cr
Interest balance 1,059.50Cr (04May2016)
Available balance 793.56Cr
Authorisation balance 793.56Cr
Other details
`
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/