2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

fhe,.pl: fixing eventMap fixes (Forum #27757)

git-svn-id: https://svn.fhem.de/fhem/trunk@6782 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-10-18 06:14:57 +00:00
parent 56a8767a0f
commit 1b9ffe6322

View File

@ -3261,20 +3261,18 @@ ReplaceEventMap($$$)
foreach my $rv (@emList) { foreach my $rv (@emList) {
# Real-Event-Regexp:GivenName[:modifier] # Real-Event-Regexp:GivenName[:modifier]
my ($re, $val, $modifier) = split(":", $rv, 3); my ($re, $val, $modifier) = split(":", $rv, 3);
my $reIsWord = ($re =~ m/^\w*$/); # dim100% is not \w only, cant use \b
next if(!defined($val)); next if(!defined($val));
if($dir) { # event -> GivenName if($dir) { # event -> GivenName
my $reIsWord = ($re =~ m/^\w*$/); # dim100% is not \w only, cant use \b
if($reIsWord) { if($reIsWord) {
if($str =~ m/\b$re\b/) { if($str =~ m/\b$re\b/) {
$str =~ s/\b$re\b/$val/; $str =~ s/\b$re\b/$val/;
$changed = 1; $changed = 1;
last;
} }
} else { } else {
if($str =~ m/$re/) { if($str =~ m/$re/) {
$str =~ s/$re/$val/; $str =~ s/$re/$val/;
$changed = 1; $changed = 1;
last;
} }
} }
@ -3282,21 +3280,22 @@ ReplaceEventMap($$$)
if($nstr eq $val) { # for special translations like <> and << if($nstr eq $val) { # for special translations like <> and <<
$nstr = $re; $nstr = $re;
$changed = 1; $changed = 1;
last; } else {
} elsif($reIsWord) { my $reIsWord = ($val =~ m/^\w*$/);
if($nstr =~ m/$val/) { if($reIsWord) {
$nstr =~ s/$val/$re/; if($nstr =~ m/\b$val\b/) {
$changed = 1;
last;
}
} elsif($nstr =~ m/\b$val\b/) {
$nstr =~ s/\b$val\b/$re/; $nstr =~ s/\b$val\b/$re/;
$changed = 1; $changed = 1;
last;
} }
} elsif($nstr =~ m/$val/) {
$nstr =~ s/$val/$re/;
$changed = 1;
}
}
}
last if($changed);
} }
}
return $str if($dir); return $str if($dir);
if($changed) { if($changed) {