# Need some quick assistance

**URL:** https://discourse.nodered.org/t/need-some-quick-assistance/42497
**Category:** General
**Created:** [11 March 2021 17:06 UTC](https://discourse.nodered.org/t/need-some-quick-assistance/42497 "2021-03-11T17:06:27Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![muddro1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muddro1/32/38671_2.png) [@muddro1](https://discourse.nodered.org/u/muddro1)
#### Post date: [11 March 2021 17:06 UTC](https://discourse.nodered.org/t/need-some-quick-assistance/42497/1 "2021-03-11T17:06:27Z")

</div>

I am creating a flow that triggers when I receive certain text messages. The texts will always contain the following language:

"MyENVERA: PERSON just arrived for ME, was verified and entry granted"

I want to be able to extract the PERSON from the payload so I can send it to a notification on my google home, saying something along the lines of PERSON has arrived.

I am able to get the text, no problem, and only read the texts that contain this message, but I am lost after that on how to extract the PERSON. Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 March 2021 17:23 UTC](https://discourse.nodered.org/t/need-some-quick-assistance/42497/2 "2021-03-11T17:23:59Z")

</div>

In a function node something like  
`msg.payload = msg.payload.split(" ")[1]`  
should do it. The `split` splits it into an array, splitting on space, then the `[1]` says to take the second element which will be the PERSON string. However that assumes that it is just one word. Otherwise it is more complex.

Do you have control of the message? If so then changing the text might make it easier. Imagine the case where the name contained the word "just". It then becomes rather tricky. Does the text need to be human readable? If not then send a JSON string. If it does then perhaps surround the name with single quotes or something similar, then you could split on the quotes.

---

<div class="post-metadata">

### Author: ![muddro1](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/muddro1/32/38671_2.png) [@muddro1](https://discourse.nodered.org/u/muddro1)
#### Post date: [11 March 2021 17:48 UTC](https://discourse.nodered.org/t/need-some-quick-assistance/42497/3 "2021-03-11T17:48:23Z")

</div>

I don't have control over the message and it does have more than one word for the person. The constants that I have to work with are trying to extract from "MyENVERA: " and " just...". All that stuff on the quotes I can drop and just take what's left. Just how to do it? And need to maintain spaces in the PERSON bexause it can be more than one word.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 March 2021 18:04 UTC](https://discourse.nodered.org/t/need-some-quick-assistance/42497/4 "2021-03-11T18:04:54Z")

</div>

Split on space then drop the first element and step through until you find just, then use `join()` to put it back together.

---

<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: [10 May 2021 18:05 UTC](https://discourse.nodered.org/t/need-some-quick-assistance/42497/5 "2021-05-10T18:05:05Z")

</div>

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