Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 708 Bytes

regex.md

File metadata and controls

23 lines (20 loc) · 708 Bytes

URL

Here is the structure of a URL: Image Structure

This regex stracts most elemnts of a URL including scheme, user, subdomain, domain, tld, path, query, and fragmentation. It still needs some improvements because the 3rd group (sibdomain, domain, tld) is not working perfectly.

(?i)(http[s]?:\/\/)?(?i)([0-9a-z-]*@)?(([0-9a-z-]+\.)*([0-9a-z-]{1,256})+(\.[0-9a-z-]{2,})+){1}(:\d*)*([\/|?]+[-a-zA-Z0-9()@:%_\+.~#?&\/=]*)*

results can be found here.

IPv4

^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$

or

^(?:\d{1,3}\.){3}\d{1,3}$

IPv6

^([0-9a-fA-F]){1,4}(:([0-9a-fA-F]){1,4}){7}$