/
(?(DEFINE)
(?<unreserved> [-._~[:alnum:]] )
(?<sub_delims> [!$&'()*+,;=] )
(?<pct_encoded> %[[:xdigit:]][[:xdigit:]] )
(?<pchar> @|(?&unreserved)|(?&pct_encoded)|(?&sub_delims) )
(?<seg_nz_nc> (?&pchar)+ )
(?<seg_nz> (?::|(?&pchar))+ )
(?<seg> (?::|(?&pchar))* )
(?<rootless> (?&seg_nz)(?:\/(?&seg))* )
(?<noscheme> (?&seg_nz_nc)(?:\/(?&seg)*) )
(?<absolute> \/(?:(?&seg_nz)(?:\/(?&seg))*)? )
(?<abempty> (?:\/(?&seg))* )
)
^(?:(?&rootless)|(?&noscheme)|(?&absolute)|(?&abempty))$
/
gix