using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"^\w+(\s\w&\w)";
string input = @"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
";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx