using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<=[,""])\b(?P<HostName>\w+)(?=,Default)";
string input = @"""2018-12-12 13:25:30"",""Renju, Jacob,M(renjutest)"",""Renju, Jacob, M (rtest),Renju123,Default Site,Test/firewall"",""10.221.5.136"",""XXX.XXX.XXX.XXX"",""Allowed"",""16 (A)"",""NOERROR"",""1XX.1X.1XX.1XX.Test.com."",""Computer Security""
""2018-12-12 13:09:55"",""rtest"",""Renju123,Default Site,Renju Renju/Renju"",""10.250.33.85"",""XXX.XXX.XXX.XXX"",""Allowed"",""12 (PTR)"",""NOERROR"",""1XX.1X.1XX.1XX.Test.com."",""Software/Technology""
""2018-12-12 14:29:49"",""Default Site"",""Renju Test/Firewal,Default Site"",""10.250.33.8"",""1XX.1X.1XX.1XX.Test.com"",""Allowed"",""28 (AAAA)"",""NXDOMAIN"",""targets."","".
";
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