All pastes #749287 Raw Edit

Untitled

public text v1 · immutable
#749287 ·published 2007-10-25 16:11 UTC
rendered paste body
        my ( $peer, $ip, $type, $mask, $port, $status ) = ( $line =~ /
                ([\w\d\-_]+)    # First capture, peer name
                \/?\s+          # Optional trailing slash, whitespace
                \(?             # Optional opening parenthesis
                ([\w\d\.]+)     # Second capture, IP address  
                \)?             # Optional closing parenthesis
                \s+             # Whitespace
                \(?             # Optional open parenthesis
                ([\w\d]+)       # Third capture, type
                \)?             # Optional ending parenthesis
                \s+             # Whitespace
                ([\w\d\.]+)     # Forth capture, mask
                \s+             # Whitespace
                ([\w\d]+)       # Fifth capture, port
                \s+             # Whitespace
                ([\w\d]+)       # Final capture, status
        /x );

Matches both:
 rpc-pbx-per-01/  10.46.26.252    (S)  255.255.255.255  4569          UNREACHABLE
 rpc-pbx-glb-01/  (Unspecified)   (S)  255.255.255.255  4569          UNKNOWN