my ($ip) = ($record =~ /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \[UDP: \[(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\]:\d+\]: /); # returns the IP my ($ip) = ($record =~ s/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \[UDP: \[(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\]:\d+\]: //); # returns 1.. #how do I get the latter to match the first?