perl -ne 'print if /(\d{1,3}\.){3}(\d{1,3})/ and $1 < 256 and ... and $4 < 256;'
Unfortunately, capture groups don't change their numbering under a counted quantifier (a misapprehension I've suffered more than once), so it's necessary to use four explicit captures for the above to work:
c:\@Work\Perl\monks>perl -wMstrict -MData::Dump -le
"$_ = '12.34.56.78';
;;
/(\d{1,3}\.){3}(\d{1,3})/;
dd [ $1, $2, $3, $4 ];
;;
/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/;
dd [ $1, $2, $3, $4 ];
"
["56.", 78, undef, undef]
[12, 34, 56, 78]
Give a man a fish: <%-(-(-(-<
|