Regular expression validating url

Rated 4.75/5 based on 671 customer reviews

my Java Script URI parsing library does strict URI validation as per RFC 3986.

Code can be found at: https://github.com/garycourt/uri-js Hey, just randomly came across this...

He also sliced up the Unicode ranges :=), that's the reason his one is so long :) = 224.0.0.0/8 are excluded by the second validation block.

He also sliced up the Unicode ranges :=), that's the reason his one is so long :) Need to mention I took the idea of validating the possible IP address ranges in the URL while looking at other developers regular expressions I have seen in your tests, especially the one from @scottgonzales.

Code can be found at: https://github.com/garycourt/uri-js I changed it a little bit so that it's valid in Ruby.

It uses a much larger regular expression then this one.

It is easy to just remove the unwanted parts of the validation to fit different scopes (length, precision) so I will probably add more options like the list of existing TLD (possibly grouped), the list of existing protocols and/or a fall back for a more generic protocol match too. my Java Script URI parsing library does strict URI validation as per RFC 3986.

The second validation block also takes care of excluding IP address terminating with 0 or 255 (non usable network and broadcast addresses of each class C network).

It is easy to just remove the unwanted parts of the validation to fit different scopes (length, precision) so I will probably add more options like the list of existing TLD (possibly grouped), the list of existing protocols and/or a fall back for a more generic protocol match too. and give it an expression to match against the specified control’s content.There are even built in expressions to choose from…of which is “Internet URL”. Below is my helper method for doing this, but you can easily write the check inline if you wish.It is Java Script based and uses XReg Exp library for enhanced features.Consult the regular expression documentation or the regular expression solutions to common problems section of this page for examples. You can create range of characters using the hyphen character such as A-Z (A to Z).

Leave a Reply