my $re = qr{ # match this ( # save to $1 \b (?&byte) ( \. (?&byte) ){3} \b ) (?(DEFINE) (? 2[0-4]\d | 25[0-5] | 1\d\d | [1-9]?\d ) ) }x;