C# 判断输入的字符串是否是一个超链接

       ///

From:www.uzhanbao.com
         /// 判断输入的字符串是否是一个超链接
         ///

         ///
         ///
         public static bool IsURL(string input)
         {
             //string pattern = @"http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?";
             string pattern = @"^[a-zA-Z]+://(\w+(-\w+)*)(\.(\w+(-\w+)*))*(\?\S*)?$";
             Regex regex = new Regex(pattern);
             return regex.IsMatch(input);
         }

你可能感兴趣的:(C#)