Build, test, and debug regular expressions
This regex captures the first three octets of an IPv4 address (for a /24 subnet) or the first four hextets of an IPv6 address (for a /64 subnet) at the beginning of a line. It stores the extracted network prefix inside a named capture group called "srcNet" while expecting a trailing period or colon to denote the separation from the rest of the address. It is highly useful for parsing server logs, extracting source network boundaries, or analyzing network traffic data where identifying the subnet is required.