use strict;
my $str = '2011-04026T19:10:17-06:00 ant-fw : %ASA-4-106023: Deny tcp src inside:192.1.1.102/3191 dst outside:204.1.1.28/443 by access-group "inisde" [0x0,0x0]
2011-04026T19:28:24-06:00 ant-fw : %ASA-4-106100: access-list dmz permitted udp dmz/10.1.1.20(123) -> outside/91.1.1.4(123) hit-cnt 1 first hit [0x7f55f1d2, 0x0]
';
my $regex = qr/access-list.*\b(?<src>\d+\.\d+\.\d+\.\d+).*\-\>.*\b(?<dst>\d+\.\d+\.\d+\.\d+)/p;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html