using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"Group\sMembership:\s+(([A-Za-z0-9-_]+\\)((?<test>[A-Za-z0-9-_ ]+))\s+)";
string input = @"Subject:
Security ID:
Account Name:
Account Domain:
Logon ID:
Logon Type: 3
New Logon:
Security ID: ABC\SH07
Account Name: SH07
Account Domain: ABC
Logon ID: 0xEB7A5403
Event in sequence: 1 of 1
Group Membership:
ABC\Domain Users
Everyone
BUILTIN\Users
NT AUTHORITY\NETWORK
NT AUTHORITY\Authenticated Users
NT AUTHORITY\This Organization
ABC\FS-ABCDEFG-Workspaces_CS-Production-WIP_MODIFY
ABC\FS-ABCDEFG-Workspaces_CS-EntertainmentDesign-WIP_READ
ABC\FS-ABCDEFG-Wspaces_CS-Print-WIP_READ
ABC\Workstations-Desktop-Add Remove
ABC\FS-ABCDEFG-Wpaces_CS-Imagery-WIP_READ
Authentication authority asserted identity
ABC\APP-JDE-123";
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