please make regexp DRY...so you can modify it at one place. like:
```
ip_port_regexp = /\[([:\w]+)\](:(\d+))?/
if match_data = session_ip.match(ip_port_regexp)
```