# How to use the match regex?

**URL:** https://forums.losant.com/t/how-to-use-the-match-regex/4540
**Category:** Help
**Tags:** conditional
**Created:** [May 20, 2022, 9:59am UTC](https://forums.losant.com/t/how-to-use-the-match-regex/4540 "2022-05-20T09:59:48Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)
#### Post date: [May 20, 2022, 9:59am UTC](https://forums.losant.com/t/how-to-use-the-match-regex/4540/1 "2022-05-20T09:59:48Z")

</div>

Hi there,  
I am following this:

- `{{#match str regExpStr}}` : Returns true if `str` matches the regular expression `regExpStr` .  
but cannot figure out the correct syntax in the conditional block:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/b/b03a080f7c1dfa9d8a5b3050a27759683070c977.png)

In this example I just want to see whether it contains the string not connected.  
Thanks.

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [May 20, 2022, 1:40pm UTC](https://forums.losant.com/t/how-to-use-the-match-regex/4540/2 "2022-05-20T13:40:00Z")

</div>

You’re trying to use a [block helper string template](https://docs.losant.com/workflows/accessing-payload-data/#conditional-block-helpers) in an input that takes an [expression](https://docs.losant.com/workflows/accessing-payload-data/#expressions), which is why you’re running into problems.

The way I would solve this is as follows:

- Before your [Conditional Node](https://docs.losant.com/workflows/logic/conditional/), insert a [Mutate Node](https://docs.losant.com/workflows/logic/mutate/).
- In the Mutate Node, add a new value to your payload and set the value to `{{#match data.current.ttn.body 'not connected'}}true{{else}}false{{/match}}`. Also, check the “Treat value as JSON” checkbox. Put the value anywhere you want on your payload; for this example, let’s say it goes at `working.isMatch`.
- Then, in your Conditional Node, the expression you check is simply `{{working.isMatch}}`. If it’s `true`, it will take the true path, and if `false`, it will take the false path.

---

<div class="post-metadata">

### Author: ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)
#### Post date: [May 20, 2022, 7:12pm UTC](https://forums.losant.com/t/how-to-use-the-match-regex/4540/3 "2022-05-20T19:12:46Z")

</div>

This makes sense yes.
