using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?<!cpc|accounts\.)(google|bing|search\.yahoo|search\.myway|yandex|duckduckgo|ecosia|search\.tb\.ask|baidu)(?!.*cpc)";
string input = @"google/cpc/[google][cpc][house][sale]
google/cpc/[google][cpc][condo][sale]
accounts.google.com.sg
accounts.google.co.id
google.com
google.com.ph
google.co.th
bing.com
google.co.uk
com.google.android.googlequicksearchbox
google.com.sg
google.com.au
google.com.vn
google.ca
google.co.id
google.com.hk
search.yahoo.com
duckduckgo.com
google.de
ph.search.yahoo.com
google.co.in
google.fr
google.co.jp
google.co.kr
google.com.my
google.ae
google.se
google.ch
int.search.myway.com
yandex.ru
google.ru
google.com.tw
google.nl
cn.bing.com
ecosia.org
google.it
google.dk
google.co.nz
int.search.tb.ask.com
search.yahoo.co.jp
google.co.za
google.no
google.es
google.be
th.search.yahoo.com
google.fi
baidu.com
google.ie
google.com.tr
uk.search.yahoo.com";
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