Is valid url with regular expression

image_pdfimage_print
   
 

//The MIT License (MIT)
//http://arolibraries.codeplex.com/license
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AroLibraries.ExtensionMethods.Strings
{
    public static class StringExt
    {

        public static bool Ext_IsValidUrl(this string text)
        {
            ///Uri temp; return Uri.TryCreate(text);
            Regex rx = new Regex(@"http(s)?://([w-]+.)+[w-]+(/[w- ./?%&=]*)?", RegexOptions.Compiled);
            return rx.IsMatch(text);
        }

    }
}