# How to check if the key's value exists or not

**URL:** <https://discourse.nodered.org/t/how-to-check-if-the-keys-value-exists-or-not/34167>\
**Category:** General\
**Created:** [13 October 2020 08:46 UTC](https://discourse.nodered.org/t/how-to-check-if-the-keys-value-exists-or-not/34167 "2020-10-13T08:46:29Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [13 October 2020 18:11 UTC](https://discourse.nodered.org/t/how-to-check-if-the-keys-value-exists-or-not/34167/21 "2020-10-13T18:11:29Z")

</div>

> [@E1cid](#):
>
> handle emtpy line, #Comment, [Session] .

Wow. Wonderful!!!  
I have tried many different patterns with the correct results.  
I don't think you can handle something like that either 😮  
I am extremely grateful!

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [13 October 2020 18:16 UTC](https://discourse.nodered.org/t/how-to-check-if-the-keys-value-exists-or-not/34167/22 "2020-10-13T18:16:47Z")

</div>

No problem, happy to help

This is fix for if end is key4[EOF]

```auto
[{"id":"47d5a245.2d2b3c","type":"change","z":"7760f563.ea0324","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$join(\t $map(\t $split(payload, \"\\n\"),\t function($v){\t $contains($substring($trim($v), 0, 1),/#|\\[/) or \t $count($split($v,\"=\")) > 1 or \t $trim($v) = \"\" \t ? $v : ($substring($trim($v), -5) != \"[EOF]\" ? $v & '=' : $split($v, \"[EOF]\")[0] & '=[EOF]')\t }\t ),\t \"\\n\"\t)\t\t\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":700,"y":1720,"wires":[["d6d6a27b.5b5538","7f27e2e4.a94a1c"]]}]

```

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [13 October 2020 18:20 UTC](https://discourse.nodered.org/t/how-to-check-if-the-keys-value-exists-or-not/34167/23 "2020-10-13T18:20:12Z")

</div>

I wanted to thank you for helping me today.  
Have a nice day!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [27 October 2020 18:20 UTC](https://discourse.nodered.org/t/how-to-check-if-the-keys-value-exists-or-not/34167/24 "2020-10-27T18:20:15Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://discourse.nodered.org/t/how-to-check-if-the-keys-value-exists-or-not/34167.md?page=1)
