$_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.
One needs to check if the entered URL for a Form matches the semantics for URLs or if a entered URL is valid, for example if your App allows user accounts, etc.
Matching URLs is also a great practice for learning Regular Expressions.
In this pen you can see the things that are matched (green) and the original URLs (grey). The Dot needs to be escaped because otherwise it would match every character (Reg Ex with . This rule, however, doesn't fit anymore since the new TLDs are "real" words such as and so on. See the Pen Reg - Match URLs (Part 3) by Kevin Gimbel (@kevingimbel) on Code Pen.
A list of new TLDs can be found on gandi.net, a registrant and hosting company. See the Pen Reg - Match URLs (Part 2) by Kevin Gimbel (@kevingimbel) on Code Pen. You can find every pen created for this Blog in the collection at Code Pen.