Mega Code Archive

 
Categories / C# / Regular Expressions
 

Is Domain By Regular Expression

using System.Text.RegularExpressions; public static class Validate {     public static bool IsDomain(string value)     {         if (string.IsNullOrEmpty(value))             return false;         Regex url = new Regex(@"^[\w\-_]+((\.[\w\-_]+)+([a-z]))?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);         return url.IsMatch(value);     } }