in reply to Re: Filtering out IP addresses
in thread Filtering out IP addresses

Great idea. Let's generalize to respect the length of each field and make the substitutions in the original text.
use strict; use warnings; use Regexp::Common qw /net/; my $string ='194.66.82.11'; $string =~ s/$RE{net}{IPv4}{-keep} /'x'x(length $2) . '.' . 'x'x(length $3) . '.' . 'x'x(length $4) . '.' . $5 /xge; print $string;
Bill

Replies are listed 'Best First'.
Re^3: Filtering out IP addresses
by AppleFritter (Vicar) on Jul 23, 2014 at 09:16 UTC

    Great idea. Let's generalize to respect the length of each field and make the substitutions in the original text.

    Not matching the original field lengths may actually be a feature here - you'd be providing extra information if you did, which may or may not be what you want.