Ing. Branislav Gerzo wrote:
anyone knows how looks _good_ ip adress regexp ?
I use something like:

(\d{1,3}\.){3}\d{1,3}

but that also matches for example 888.777.444.222, which is of course
not good ip adress.

What's your definition of a "good" IP address? Do you care about correct DNS, do you care about whether the address is in use?


To me, this test comes to mind:

    sub goodIP { gethostbyaddr pack('C4', split /\./, shift), 2 }
    print "Good IP address\n" if goodIP('11.22.33.44');

I don't want use any module for this,

Why?

I only want fing proper regular expression for IPs.

You'd better define "good".

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to