mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
fhem.pl: case insensitive devspec2array search patch from Phill (Forum #84326)
git-svn-id: https://svn.fhem.de/fhem/trunk@16170 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f924134967
commit
3abd49a0c1
@ -270,8 +270,9 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<li>a NAME=VALUE pair, where NAME can be an internal value like TYPE, a
|
||||
Reading-Name or an attribute. VALUE is a regexp. To negate the
|
||||
comparison, use NAME!=VALUE. To restrict the search, use i: as prefix
|
||||
for internal values, r: for readings and a: for attributes. See the
|
||||
example below.</li>
|
||||
for internal values, r: for readings and a: for attributes.
|
||||
See the example below.
|
||||
Case sensitivity is being ignored using ~ or !~. </li>
|
||||
<li>if the spec is followed by the expression :FILTER=NAME=VALUE, then the
|
||||
values found in the first round are filtered by the second expression.
|
||||
</ul>
|
||||
@ -284,6 +285,7 @@ A line ending with \ will be concatenated with the next one, so long lines
|
||||
<code>set room=kitchen:FILTER=STATE=on off</code><br>
|
||||
<code>set room=kitchen:FILTER=STATE!=off off</code><br>
|
||||
<code>list disabled=</code><br>
|
||||
<code>list room~office</code><br>
|
||||
<code>list TYPE=FS20 STATE</code><br>
|
||||
<code>list i:TYPE=FS20 STATE</code><br>
|
||||
</ul>
|
||||
|
@ -264,7 +264,8 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
|
||||
Um die Bedingung zu negieren, muss NAME!=WERT verwendet werden.
|
||||
Um die Suche einzugrenzen, kann man als Praefix i: für internal
|
||||
Werte, r: für Reading-Namen und a: für Attribute verwenden,
|
||||
siehe das Beispiel unten.
|
||||
siehe das Beispiel unten. Groß-/Kleinschreibung wird durch die
|
||||
Verwendung von ~ oder !~ ignoriert.
|
||||
</li>
|
||||
<li>Falls die Spezifikation von :FILTER=NAME=WERT gefolgt wird,
|
||||
dann wird die zuvor gefundene Liste durch diesen neuen Ausdruck
|
||||
@ -279,6 +280,7 @@ Zeilen erstreckende Befehle, indem man keine \ am Zeilenende eingeben muss.</p>
|
||||
<code>set room=kitchen:FILTER=STATE=on off</code><br>
|
||||
<code>set room=kitchen:FILTER=STATE!=off off</code><br>
|
||||
<code>list disabled=</code><br>
|
||||
<code>list room~office</code><br>
|
||||
<code>list TYPE=FS20 STATE</code><br>
|
||||
<code>list i:TYPE=FS20 STATE</code><br>
|
||||
</ul>
|
||||
|
@ -1204,7 +1204,7 @@ devspec2array($;$)
|
||||
my @res;
|
||||
foreach my $dName (split(":FILTER=", $l)) {
|
||||
my ($n,$op,$re) = ("NAME","=",$dName);
|
||||
if($dName =~ m/^(.*?)(=|!=|<=|>=|<|>)(.*)$/) {
|
||||
if($dName =~ m/^(.*?)(=|!=|~|!~|<=|>=|<|>)(.*)$/) {
|
||||
($n,$op,$re) = ($1,$2,$3);
|
||||
$isAttr = 1; # Compatibility: return "" instead of $name
|
||||
}
|
||||
@ -1250,6 +1250,8 @@ devspec2array($;$)
|
||||
eval { # a bad regexp is deadly
|
||||
if(($op eq "=" && $val =~ m/$lre/s) ||
|
||||
($op eq "!=" && $val !~ m/$lre/s) ||
|
||||
($op eq "~" && $val =~ m/$lre/is) ||
|
||||
($op eq "!~" && $val !~ m/$lre/is) ||
|
||||
($op eq "<" && $valReNum && $val < $re) ||
|
||||
($op eq ">" && $valReNum && $val > $re) ||
|
||||
($op eq "<=" && $valReNum && $val <= $re) ||
|
||||
|
Loading…
Reference in New Issue
Block a user