Contains() function with multiple values


#21

The Expressioncontains()” looks for a string that contains X
The Expressionmatches()” looks for matches.

IE:
a b c
does not match
a or b


Edit: I wonder what your success would be using three letter words in your tests.


#22

Hm. Nothing seems to work anymore. It works if I don’t use the OR pipe. Contains() and matches() both match single values, but only without the slashes and as soon as I add the OR it says false.

contains(texttomatch, 'two') is true.
contains(texttomatch, '/two/') is false.

I had a piston on Smarthings that matched weather conditions that worked fine for years and I noticed it doesn’t work anymore. I have moved to Hubitat, though, which is why I wondered where it’s evaluated.


#23

I was thinking this too, but at the moment, I don’t have a Hubitat in the shop to test.


#24

Try it in the “Evalutation Console”. All three of them were true for me.


#25

Semantic error here, try using matches() instead of contains().


#26

Like this?

image


#27

Here’s an example:

[EDIT] I see now you are looking at multiple entries. I’ll play around with this…

[EDIT] Tried many different ways…can’t get multiple values to work. :frowning:


#28

Strange. Worked for me:

EDIT: Tried on HE and it doesn’t work. Only works on ST for me.