use strict;
my $str = '2015-07-08 12:49:07.183852|INFO |VirtualServerBase| 3| client disconnected \'Ròem\'(id:6336) reason \'invokerid=20 invokername=Alphonse invokeruid=loremipsum2= reasonmsg=test\'
2015-07-08 11:59:23.178055|INFO |VirtualServerBase| 3| client disconnected \'Trakiyen\'(id:20460) reason \'invokerid=0 invokername=server reasonmsg=idle time exceeded\'
2015-07-08 12:40:50.591450|INFO |VirtualServerBase| 3| client disconnected \'kalash\'(id:20464) reason \'invokerid=136 invokername=Charles invokeruid=loremipsum= reasonmsg=Aller, Bisous! bantime=0
2015-07-08 00:23:03.235312|INFO |VirtualServerBase| 3| client disconnected \'Brigata FTW\'(id:20451) reason \'invokerid=103 invokername=Bob invokeruid=loremipsum3= reasonmsg=En vous souhaitant une bonne soirée <3 bantime=28800\'
';
my $regex = qr/(?m)^(?!.*\b(?:invokername=server|bantime)\b).*2015-07-08.*client disconnected.*invokername=.*$/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