From 1b9ffe632268e28b04a6ea8dda8a439a1044c337 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 18 Oct 2014 06:14:57 +0000 Subject: [PATCH] fhe,.pl: fixing eventMap fixes (Forum #27757) git-svn-id: https://svn.fhem.de/fhem/trunk@6782 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 6c91ec0f6..2e33a8cce 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -3261,20 +3261,18 @@ ReplaceEventMap($$$) foreach my $rv (@emList) { # Real-Event-Regexp:GivenName[:modifier] my ($re, $val, $modifier) = split(":", $rv, 3); - my $reIsWord = ($re =~ m/^\w*$/); # dim100% is not \w only, cant use \b next if(!defined($val)); if($dir) { # event -> GivenName + my $reIsWord = ($re =~ m/^\w*$/); # dim100% is not \w only, cant use \b if($reIsWord) { if($str =~ m/\b$re\b/) { $str =~ s/\b$re\b/$val/; $changed = 1; - last; } } else { if($str =~ m/$re/) { $str =~ s/$re/$val/; $changed = 1; - last; } } @@ -3282,20 +3280,21 @@ ReplaceEventMap($$$) if($nstr eq $val) { # for special translations like <> and << $nstr = $re; $changed = 1; - last; - } elsif($reIsWord) { - if($nstr =~ m/$val/) { + } else { + my $reIsWord = ($val =~ m/^\w*$/); + if($reIsWord) { + if($nstr =~ m/\b$val\b/) { + $nstr =~ s/\b$val\b/$re/; + $changed = 1; + } + } elsif($nstr =~ m/$val/) { $nstr =~ s/$val/$re/; $changed = 1; - last; } - } elsif($nstr =~ m/\b$val\b/) { - $nstr =~ s/\b$val\b/$re/; - $changed = 1; - last; } - } + last if($changed); + } return $str if($dir);