in reply to Re^4: Create a ipset for blocking networks based on internet sources
in thread Create a ipset for blocking networks based on internet sources
qr/^((\d{1,3}\.){3}\d{1,3})/m
The problem there is that you have two sets of capturing parentheses. You can change the inner capturing parentheses to non-capturing parentheses:
qr/^((?:\d{1,3}\.){3}\d{1,3})/m
And you could change the foreach loop:
foreach ( $response->content =~ /$regex/g ) { @sys = (qw(ipset add), "temp_$set_name", $_); system(@sys) == 0 or die "Unable to add $_ to temp_$set_na +me because: $?"; }
To a while loop that only accesses $1:
while ( $response->content =~ /$regex/g ) { @sys = (qw(ipset add), "temp_$set_name", $1); system(@sys) == 0 or die "Unable to add $_ to temp_$set_na +me because: $?"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Create a ipset for blocking networks based on internet sources
by mimosinnet (Beadle) on Apr 27, 2012 at 17:23 UTC |