I'm no expert on regex's, but IP @'s are not all that easy to match and
validate at the same time.  There is a good discussion of precisely this
problem in Chap 4 of "Mastering Regular Expressions" by  J E F Friedl, pub
O'Reilly, at pp 123-125.  He concludes:-

"Sometimes it's better to take some of the work out of the regex.  For
example, going back to

^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$

and wrapping each component in parentheses will stuff the numbers into $1,
$2, $3 and $4, which can then be validated by other programming constructs".

The discussion context is Perl specifically.

HTH, GStC.


-----Original Message-----
From: Jesse Taylor [mailto:[EMAIL PROTECTED] 
Sent: Sunday, January 23, 2005 5:20 PM
To: beginners@perl.org
Subject: Storing $DIGIT variables in arrays

<snip/>

while($url=<INFILE>)
{
   chomp($url);
   $html=get("$url")
      or die "Couldn't open page located at $url";

   @ips = $html =~
/(\d{1,3}[0-255]\.\d{1,3}[0-255]\.\d{1,3}[0-255]\.\d{1,3}[0-255])/g;

-- 
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