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 --- firstseen.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'firstseen.pl') diff --git a/firstseen.pl b/firstseen.pl index 1e3d305..7d8f3b6 100644 --- a/firstseen.pl +++ b/firstseen.pl @@ -9,9 +9,10 @@ if ($#ARGV ne 2){ my $chan=$ARGV[1]; my $folder=$ARGV[0]; 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; @@ -24,7 +25,7 @@ my $line; open(file, $file) or die("Could not open file $file"); foreach $line () { - if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] (Action: )?? /i) { + if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-9]{2})?\] (Action: )?? /i) { if ($date =~ /^irgendwas$/) { print "$nick belongs to inventory\n"; exit 0; @@ -37,8 +38,8 @@ foreach $line () { if ($line =~ m/^\[00:00(:00)?\] --- /){ ($date=$line)=~s/^\[00:00(:00)?\] --- (.*)\n/$2/; } - if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-]{2})?\] Nick change: .* -> $nick/i) { - ($newnick=$line)=~s/.* Nick change: (.*) -> $nick\n/$1/i; + if ($line =~ m/^\[[0-9]{2}:[0-9]{2}(:[0-]{2})?\] Nick change: .* -> $snick/i) { + ($newnick=$line)=~s/.* Nick change: (.*) -> $snick\n/$1/i; print "$nick was $newnick\n"; exec($^X, $0, $folder, $chan, $newnick); exit 0 -- cgit v1.2.3