##
if($line =~ /Handling NSPAdvice for mechanism \[4\]/) {
# alternative: if ( index($line,'Handling NSPAdvice for mechanism [4]')>=0 ) {
####
if ($line =~ /Authentication mechanism returned [[](\S*)[]]/) {
####
if ($line =~ /Authentication mechanism returned \[(\-?\d+)\]/) {
# the RE above would match e.g. [4] -> $1=4, [-10] -> $1=-10, etc.