Regular Expressions 101

Community Patterns

Find ipv6 subnet

0

Regular Expression
Python

r"
((?:(?:(?:[0-9a-fA-F]){1,4}):){1,4}:/[^\s:]\d{0,2})
"
gm

Description

This regexp is able to find ipv6 subnets in the compressed form (e.g: 2001:db8::/32). It doesn't perform any validation to the ipv6 addresses itself though.

Submitted by anonymous - 3 years ago