I did make one change: the "-*" in both domain and host was (incorrectly) succeeding against " so I changed it to "-? However it will be very easy to add 'localhost' as an acceptable exception. :\.\d))" 'IP address dotted notation octets 'excludes loopback network 0.0.0.0 'excludes reserved space = 18.104.22.168 'excludes network & broacast addresses '(first & last IP address of each class) rxs = rxs "(? $_iu S I have added simple network ranges validation, the rules I used are: - valid range 22.214.171.124 - 126.96.36.199, network adresses above and including 188.8.131.52 are reserved addresses - first and last IP address of each class is excluded since they are used as network broadcast addresses since I don't think this is worth implementing completely in a regular expression, a following pass should exclude the Intranet address space: 10.0.0.0 - 10.255.255.255 172.16.0.0 - 1.255 192.168.0.0 - 192.168.255.255 the loopback and the automatic configuration address space: 127.0.0.0 - 127.255.255.255 169.254.0.0 - 169.254.255.255 while the local, multicast and and the reserved address spaces: 0.0.0.0 - 0.255.255.255 (SPECIAL-IPV4-LOCAL-ID-IANA-RESERVED) 184.108.40.206 - 239.255.255 (MCAST-NET) 240.0.0.0 - 255.255.255.255 (SPECIAL-IPV4-FUTURE-USE-IANA-RESERVED) should already be excluded by the above regular expression. Negative lookahead is used instead NOTE, that package does fuzzy search, not strict validation. If they copy it out and back into a browser so they may not know what's wrong with it upon visual inspection. What I can see is that browsers accept that but then they insert a slash in it when finished.