What would be the regular expression to find the substrings www. and http:// in a domain name.
Basically I am writing an MVC validation to disallow a word that includes
www., http:// or http://www. in it.
Try:
Regex.IsMatch(myString, @"(www\.|http://)");
If you want to specify that they aren't allowed at the start of the string, but allow them elsewhere, use:
Regex.IsMatch(myString, @"^(www\.|http://)");
DoesNotMatch? msdn.microsoft.com/en-us/…