package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)^\w+(\s\w&\w)`)
var str = `Employee Communications & Engagement, WB
SVP of Global Insights & Analytics, WB
SVP of Nonfiction, HBO Max
VP of Talent Relations and Development, TCM
Global Franchise Management, DC
WB Technology Group
President, EMEA & APAC
SVP & CFO, EMEA & APAC
Director, Service Delivery
SVP for Sales and Client Partnerships, Legacy Turner
Technical Director, WarnerMedia
Dir. of Brand Distribution, WarnerMedia
Dir. Strategic & Consumer Insights, Turner Sports
Manager for Digital Asset & Photo Library, Brand Experience
Creative Manager for Creative Services, Cartoon Network
// 2 words
Cincinnati Bearcats
Miami (FL) Hurricanes
Miami (OH) Redhawks
// three words
South Florida Bulls // 2.1
Saint Joseph's Hawks
Duke Blue Devils // 1.2
UNLV Runnin' Rebels // with apostrophe
// 4 words
North Carolina Tar Heels
Notre Dame Fighting Irish
St John's Red Storm
Florida A&M Rattlers
William & Mary Tribe
St Francis (PA) Red Flash
`
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/