I am trying to find out a URL which belongs to :
http://domain.blob.core.windows.net/
https://domain.blob.core.windows.net/
http://domain.blob.core.windows.net
https://domain.blob.core.windows.net
The regex which I wrote
Regex reg2= new Regex(@"^http(s?)://[0-9a-zA-Z](.blob.core.windows.net)(/?)$");
string url = "http://abc.blob.core.windows.net";
if(reg2.IsMatch(url))
{
Console.WriteLine("Yes");
}
else
{
Console.WriteLine("no");
}
I am not able to find the match. It's not working :( I am pretty weak in regex. So can anyone help me to find out my mistake? I am using c#. It always prints no.
UPDATE : FINAL Answer which worked for me:
Regex reg2 = new Regex(@"^http(s?)\:\/\/[0-9a-zA-Z]*(\.blob\.core\.windows\.net)
(/?)$");
Just in case anybody needs something like this :)
.'s are not escaped...