From d45663caaad3fb3f266f064b9c70955bf7d985c9 Mon Sep 17 00:00:00 2001 From: lookshe Date: Wed, 11 Jan 2012 09:15:06 +0100 Subject: masked special characters only for searchstring and not for outputs --- lastspoke.pl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lastspoke.pl') diff --git a/lastspoke.pl b/lastspoke.pl index 09d9104..1c3ea27 100644 --- a/lastspoke.pl +++ b/lastspoke.pl @@ -10,9 +10,10 @@ if ($#ARGV ne 2){ my $folder=$ARGV[0]; my $chan=$ARGV[1]; my $nick=$ARGV[2]; -$nick=~s/\\/\\\\/g; -$nick=~s/\|/\\\|/g; -$nick=~s/\^/\\\^/g; +my $snick=$nick; +$snick=~s/\\/\\\\/g; +$snick=~s/\|/\\\|/g; +$snick=~s/\^/\\\^/g; my @files; @@ -32,7 +33,7 @@ my $log = File::ReadBackwards->new($file) || die $!; while ($line=$log->readline()){ # $line=$log->readline(); if ($date eq 0){ - if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] <$nick> /i && $line !~ m/joined #/ ) { + if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] <$snick> /i && $line !~ m/joined #/ ) { $date=1; ($lastaction=$line)=~s/\n//; } elsif ($line =~ m/^\[00:00(:00)?\] --- /) { -- cgit v1.2.3