use strict;
my $str = '2016-03-16T10:30:18-05:00 DEVESB2 [0x80e0018d][ldap][error] xmlmgr(map-manager): trans(1750947) gtid(1750947): Error querying server 10.158.131.139: Error while searching; see log for details
2016-03-16T10:30:17-05:00 DEVESB2 [0x804000a1][slm][info] throttle(Throttler): trans(1279): Memory(10529899/13448300kB 78.299108 free) Pool(7052687) Ports(127732/127850) Temporary-FS(116/128MB 90.625000 free) File(OK)
2016-03-16T10:30:01-05:00 DEVESB2 [DEVESB][0x80e00176][ws-proxy][error] source-http(DEFAULT_DATA1_HTTP): trans(1750611)[172.27.137.222]: No WS-Proxy service endpoints matched request.
';
my $regex = qr/^(?P<timestamp>[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}-[0-9]{2}:[0-9]{2})\s+(?P<domain>[a-zA-Z0-9]+)\s+\[(?P<msgid>0[xX][0-9a-fA-F]+)\]\[(?P<msgtype>[a-zA-Z]+)\]\[(?P<msgcat>[a-zA-Z]+)\]\s+(?P<objtype>\w+)\((?P<objname>[a-zA-Z_-]+)\):\s+trans\((?P<txnum>[0-9]+)\)(.*?):\s(?P<msgtxt>.*)/p;
if ( $str =~ /$regex/ ) {
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