https://mysite.com/
https://mysite.com/post/168755988566
https://mysite.com/post/168755988566
https://mysite.com/
void Main()
{
var urls = new List<string>();
urls.Add("https://mysite1.com/");
urls.Add("https://mysite2.com/");
urls.Add("https://mysite3.com/");
urls.Add("https://mysite4.com/");
urls.Add("https://mysite1.com/post/168755988566");
urls.Add("https://mysite2.com/post/168755988566");
urls.Add("https://mysite3.com/post/168755988566");
urls.Add("https://mysite4.com/post/168755988566");
var regexPattern = "\\/post\\/\\d*";
var r = new Regex(regexPattern);
var filteredUrls = urls.Select(x => x).Where(x => !r.IsMatch(x));
foreach (var url in filteredUrls)
{
Console.WriteLine(url);
}
}
var urls = new List<string>() {"https://mysite1.com/", "https://mysite2.com/",
"https://mysite3.com/", "https://mysite4.com/",
"https://mysite1.com/test", "https://mysite2.com/test",
"https://mysite5.com/", "https://mysite5.com/234234/23434/sdfas"};
List<String> uris = urls.Select(x => new Uri(x).GetLeftPart(UriPartial.Authority)).Distinct().ToList();
uris.ForEach(x => Console.WriteLine(x));
((https?|ftp):\/\/)?([a-z0-9+!*(),;?&=.-]+(:[a-z0-9+!*(),;?&=.-]+)?@)?([a-z0-9\-\.]*)\.(([a-z]{2,4})|([0-9]{1,3}\.([0-9]{1,3})\.([0-9]{1,3})))(:[0-9]{2,5})?(\/([a-z0-9+%-]\.?)+)*\/?(\?[a-z+&$_.-][a-z0-9;:@&%=+/.-]*)?(#[a-z_.-][a-z0-9+$%_.-]*)?