Gunnar Hjalmarsson [GH], on Friday, November 12, 2004 at 00:59 (+0100) contributed this to our collective wisdom:
GH> What's your definition of a "good" IP address? Do you care about correct GH> DNS, do you care about whether the address is in use? I care about that, if its syntax is correct: 1-255.0-255.0-255.0-255 GH> To me, this test comes to mind: GH> sub goodIP { gethostbyaddr pack('C4', split /\./, shift), 2 } GH> print "Good IP address\n" if goodIP('11.22.33.44'); after that I can use this, thanks. >> I don't want use any module for this, GH> Why? I have to first extract IP adresses with ports (20-65535) from the source (web, txt...) and ip addr and port could have more then one delimiter, for example ':', ' ', 'port' or they should be in html tables. So after some playing with that I come with: while (<TXT>) { /^((2[0-5]{2}|1\d{2}|[1-9]\d|[1-9])\.((2[0-5]{2}|1\d{2}|[1-9]\d|\d)\.){2}(2[0-5]{2}|1\d{2}|[1-9]\d|\d))(\s*(port|:|\s|<\/td>\s*<td[^>]+>)\s*)([2-9]\d|[1-9]\d{2,3}|[1-5]\d{4}|6[0-4]\d{3}|654\d{2}|655[0-2]\d|6553[0-5])$/g; ip = $1; port = $8; push(@ip,"$ip,$port); #for example } hm, quite huge regexp, hm ? -- ...m8s, cu l8r, Brano. [Ignorance won't kill you, but it makes you sweat a lot.] -=x=- Skontrolované antivírovým programom NOD32 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>