Is Http URL - CSharp System

CSharp examples for System:String Match

Description

Is Http URL

Demo Code


using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.Text;
using System.Reflection;
using System.Linq;
using System.ComponentModel;
using System.Collections.Generic;
using System;/*w  w w. ja v a 2  s .c  om*/

public class Main{
        public static bool IsHttpURL(string value)
        {
            const string pattern = @"^(http|https)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&$%\$#\=~])*$";
            return Regex.IsMatch(value, pattern);
        }
}

Related Tutorials