using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"Client=(\w+[ \w+]*);?";
string input = @"Client=EBA;Action=OneNotePagePreviewsRealtimeProcessor
Client=EBssssA;Action=OneNotePagePreviewsRealtimeProcessor
Client=some other;Action=OneNotePagePreviewsRealtimeProcessor
Client=some other word long;Action=OneNotePagePreviewsRealtimeProcessor
Client=OWA;Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; InfoPath.2; SLCC2; Media Center PC 6.0);
Client=Hub Transport
Client=OWA;Mozilla/5.0 (Linux; Android 10; Redmi Note 8T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36;
Client=WebServices;macOS/11.2.2 (20D80) CalendarAgent/954;
Client=OutlookService;microsoft.windowscommunicationsapps;";
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