package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?im)TRN.*FRLPD\s+FRPLY.*\s*FRLPD\/([\w\s]*).*FRPLY\/([\w\s]*)\/`)
var str = `1.TORNEAMPLE/ERIC
2 HHL RT HK1 LYS IN23NOV OUT26NOV PAST
3 TRN 2C 87 6609 AF 31DEC 1 FRPLY FRLPD HK PAST *
4 TRN 2C 87 6628 AF 01JAN 4 FRLPD FRPLY HK1 1800 2007
FRLPD/LYON PART DIEU//FRPLY/PARIS GARE LYON /TGD *
5 MIS 1A HK1 PAR 23MAY-ARCHIVAGES
6 AP 04.74.07.68.39`
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/