my $regex = qr/\A ( (?: $RE{net}{IPv6} ) | # A full IPv6 address (?: [0-9a-f:%]+ ) # A portion of an IPv6 address with SQL % wildcards ) \Z/imsx;