Regex for validating url

:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(? :[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])))|::(? i bet this can be tweaked a little more but it does the job pretty nice for being so short and compact... .\w\S* or find anything that must have a text then a dot then at least 2 letters and then a ? Here is the current version: // function url_valid($url) { Rev:20110423_2000 // // Return associative array of valid URI components, or FALSE if $url is not // RFC-3986 compliant.

:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9] )(? $_iu S The post Getting parts of a URL (Regex) discusses parsing a URL to identify its various components. /; $('textarea').on('input',function()); $('textarea').trigger('input');"(([\w] :)? // top level domain OR '|((\d|[1-9]\d|1\d|2[0-4][0-9]|25[0-5])\.)'. // path and query string optional '(#([a-z0-9$_\.\ !

Leave a Reply