Regular expression for validating url in c

In that network, and are two valid and usable address. " (string contains double quotes) ' (string contains single quote) [ (string contains brackets) here is JS demo with full unicode support, including astral characters. Src is here: Since astral characters take 2 positions, [^negative] class is impossible. some=query while they may not technically be valid, it is something I could see a user typing and most browsers will fix it for them. The only pattern it won't match for me (Using it in a Java Regex) is where the IP address is '0'(ZERO) padded, like: I get as input from other tools. Public Sub Match Url(url As String) Dim rxs As String = "" 'protocol identifier rxs = rxs "(? Hi, is a valid URL but the last dot ist usually not written by convention. works in Firefox and IE Just a small comment about brodcast and network address. Ex: If a provider have two class like and, they can combine the two in a classless network: He also sliced up the Unicode ranges :=), that's the reason his one is so long :) = are excluded by the second validation block.

I'd like to use this as a basis, and I'm hoping you can help me with a simple tweak. I have been directed to read the relevant specs here: and the validity criteria are here: Thank you for the Python port !

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).

Code can be found at: I changed it a little bit so that it's valid in Ruby.

It uses a much larger regular expression then this one.

Regular expression for validating url in c