Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^5: How to best filter/direct data based on input structure?

by taint (Chaplain)
on Nov 02, 2013 at 06:45 UTC ( [id://1060897]=note: print w/replies, xml ) Need Help??


in reply to Re^4: How to best filter/direct data based on input structure?
in thread How to best filter/direct data based on input structure?

FWIW for other onlookers that this thread might attract...
It should be noted that, in order filter out only valid IP addresses;
one needs to modify the RE above:
# FROM my $results = ( $input =~ /$RE{net}{IPv4}/ or is_domain($input) ) ? $i +nput : $form; # TO my $results = ( $input =~ /^$RE{net}{IPv4}$/ or is_domain($input) ) ? +$input : $form;
Take note of the additional anchor(s) in the second line.
Difference being; in the first line, the filter is an RE for any-and-all-digits && only-digits-3-or-less-in-length. While the second filters for: <=3-in-length && <=255-in-size.

HTH

--Chris

#!/usr/bin/perl -Tw
use perl::always;
my $perl_version = "5.12.5";
print $perl_version;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1060897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-20 00:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found