# Switch Node - rules limitation

**URL:** <https://discourse.nodered.org/t/switch-node-rules-limitation/18659>\
**Category:** General\
**Created:** [1 December 2019 16:10 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659 "2019-12-01T16:10:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![StrongTown](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@StrongTown](https://discourse.nodered.org/u/StrongTown)\
**Post date:** [1 December 2019 16:10 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659/1 "2019-12-01T16:10:40Z")

</div>

When utilizing the switch node, is it possible to provide multiple variables on a single rule /test such as:

 ![SN Q](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/b/bc18f7a21bb35d363e60baa295d5afede32fef07.jpeg)

or does each word need to be a separate check?  
st

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [1 December 2019 16:15 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659/2 "2019-12-01T16:15:43Z")

</div>

"Contains" only matches the string given.

But you could use "matches regexp" and use a regular expression.

Just separate your terms with `|`. Something like `Hot|hot|Cold|cold`. Could be optimized of course if you know your way about regular expressions, like `[Hh]ot|[Cc]old`.

---

<div class="post-metadata">

**Author:** ![StrongTown](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@StrongTown](https://discourse.nodered.org/u/StrongTown)\
**Post date:** [1 December 2019 16:19 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659/3 "2019-12-01T16:19:15Z")

</div>

Terrific. Thanks kuema.

---

<div class="post-metadata">

**Author:** ![kuema](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kuema/32/6542_2.png) [@kuema](https://discourse.nodered.org/u/kuema)\
**Post date:** [1 December 2019 16:21 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659/4 "2019-12-01T16:21:56Z")

</div>

Very powerful tool these regular expressions.

If you want to play around with those, you can use this site. Just select "ECMAscript" as flavor.

> **[Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript](https://regex101.com/)**
>
> Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.

---

<div class="post-metadata">

**Author:** ![StrongTown](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@StrongTown](https://discourse.nodered.org/u/StrongTown)\
**Post date:** [1 December 2019 16:28 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659/5 "2019-12-01T16:28:00Z")

</div>

THAT is a handy tool!

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [1 December 2019 17:01 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659/6 "2019-12-01T17:01:45Z")

</div>

You could also use JSONata to achieve what you want.

---

<div class="post-metadata">

**Author:** ![cyril](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cyril/32/14890_2.png) [@cyril](https://discourse.nodered.org/u/cyril)\
**Post date:** [5 December 2019 21:08 UTC](https://discourse.nodered.org/t/switch-node-rules-limitation/18659/7 "2019-12-05T21:08:21Z")

</div>

Hi, other online regex testers:  
[https://extendsclass.com/regex-tester.html](https://extendsclass.com/regex-tester.html)  
[https://www.regextester.com](https://www.regextester.com/)
