Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Matching IP address continued

by strider corinth (Friar)
on Nov 20, 2002 at 18:44 UTC ( [id://214576]=note: print w/replies, xml ) Need Help??


in reply to Matching IP address continued

I'm guessing that it's because you're mixing /x in $re_line with the plain regexp in $re_ip. This worked fine for me:
#!/usr/bin/perl while( <DATA> ){ chomp; my $re_ip = qr/(\d+\.\d+\.\d+\.\d+):\d+/x; # added /x here + my $re_line = qr/ ^ \s* $re_ip \s* -> \s* $re_ip \s* -> \s* $re_ip + /x; my @results = /$re_line/; printf "%-18s %-18s %-18s\n", @results; } __DATA__ 136.1.1.154:33672 -> 64.210.209.51:80 -> 192.168.1.145:80 tcp 65.201.211.176:14664 -> 64.210.209.54:80 -> 192.168.1.78:80 + tcp 67.38.95.86:2116 -> 64.210.209.50:80 -> 192.168.1.103:80 + tcp 198.49.222.246:52469 -> 64.210.209.54:80 -> 192.168.1.79:80 + tcp 193.80.106.152:3781 -> 64.210.209.61:80 -> 192.168.1.81:80 + tcp 67.28.79.24:3248 -> 64.210.209.54:80 -> 192.168.1.79:80 +tcp 128.187.192.39:1218 -> 64.210.209.54:80 -> 192.168.1.78:80 +tcp 128.187.192.39:1209 -> 64.210.209.51:80 -> 192.168.1.144:80 +tcp
--
Love justice; desire mercy.

Replies are listed 'Best First'.
Re: Matching IP address continued
by Abigail-II (Bishop) on Nov 20, 2002 at 19:00 UTC
    But do you get a failure when you leave out the first /x?

    Abigail

      As it turns out, no. With my tech support days so far behind me, I forgot to assume nothing, even that the problem is real. =) Thanks, Abigail.
      --
      Love justice; desire mercy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://214576]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2024-04-23 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found