Contains() function with multiple values


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

a b c
does not match
a or b

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


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.


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


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


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


Like this?



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:


Strange. Worked for me:

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