
KevinR
Veteran

Apr 23, 2009, 8:49 AM
Post #3 of 5
(2664 views)
|
|
Re: [KevinR] Cannot print the found matched pattern
[In reply to]
|
Can't Post
|
|
To answer the reply you deleted....... I am not sure if you want all the octets or only some of them. This gets all the octets regardless of how many there are in each IP:
while($header =~ m/\b((\.?\d{1,3})+)\b/g){ print $1,"\n"; } if you wanted to match less octets change + to {3} or whatever number of octets per IP you want to match. Your regexp might not be well written using the \b anchor because the dot in each IP is part of \b. If the IP addresses are delimited by a space in $header using \s or \s+ might be a better boundary anchor. -------------------------------------------------
|