in reply to Re: resolving ip's to names in a text file
in thread resolving ip's to names in a text file

forgive me for sounding like a moron, but i am faily new to perl. How would i encorporate it into my script...the regex at least? ~Ray~
  • Comment on Re: Re: resolving ip's to names in a text file

Replies are listed 'Best First'.
Re: Re: Re: resolving ip's to names in a text file
by lshatzer (Friar) on Jul 20, 2001 at 04:09 UTC
    Taking the regex out of RE: Matching an IP address, which is from the MRE book, with a few small modifications, came up with this.
    my @ips = ($string =~ m/((?:[01]?\d\d?|2[0-4]\d|25[0-5])\.(?:[01]?\d\d +?|2[0-4]\d|25[0-5])\.(?:[01]?\d\d?|2[0-4]\d|25[0-5])\.(?:[01]?\d\d?|2 +[0-4]\d|25[0-5]))/g);
    Now @ips will have an array full of IP's, if they are valid or not is another discussion...