# How to build an Jsonata for this switch node?

**URL:** <https://discourse.nodered.org/t/how-to-build-an-jsonata-for-this-switch-node/32836>\
**Category:** General\
**Created:** [13 September 2020 20:17 UTC](https://discourse.nodered.org/t/how-to-build-an-jsonata-for-this-switch-node/32836 "2020-09-13T20:17:22Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![greengolfer](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/greengolfer/32/28276_2.png) [@greengolfer](https://discourse.nodered.org/u/greengolfer)\
**Post date:** [13 September 2020 21:32 UTC](https://discourse.nodered.org/t/how-to-build-an-jsonata-for-this-switch-node/32836/8 "2020-09-13T21:32:10Z")

</div>

As @Colin said, regex is your "friend". Kind of... as it is not the friendliest stuff to use.  
However if you want to send 3 and 4 to the same output, you can do:

 ![Screenshot 2020-09-13 at 23.29.45](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/d/bd03e68280edbdb6c4c35b4354b0ee32b5d63a42.png)

If you want to experiment with regex, you can go to [https://regex101.com/](https://regex101.com/) it will help you to build the expression.

^ is beginning of string  
$ is end of string  
| is "or"

---

_[View the full topic](https://discourse.nodered.org/t/how-to-build-an-jsonata-for-this-switch-node/32836)._
