Test, validate and match regular expressions
Matches IPv6 addresses line-by-line by requiring 2 to 7 colon-terminated hex groups (0-4 hex digits each), followed by either a final 1-4 digit hex group or an embedded IPv4 dotted quad, supporting mixed notation like ::ffff:192.168.1.1. The IPv4 part validates each octet in the 0-255 range. With the gm flags it can check multiple lines of input at once. Note it's a lightweight check that accepts zero-compressed forms like ::1 but is not fully RFC 4291 compliant, e.g. it doesn't enforce that :: appears only once.