# Remove space string node red

**URL:** <https://discourse.nodered.org/t/remove-space-string-node-red/54042>\
**Category:** General\
**Created:** [20 November 2021 21:40 UTC](https://discourse.nodered.org/t/remove-space-string-node-red/54042 "2021-11-20T21:40:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eucliwood090](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eucliwood090/32/51369_2.png) [@Eucliwood090](https://discourse.nodered.org/u/Eucliwood090)\
**Post date:** [20 November 2021 21:40 UTC](https://discourse.nodered.org/t/remove-space-string-node-red/54042/1 "2021-11-20T21:40:24Z")

</div>

Hello,

I receive a payload a string, I have arrows I can't format the code in JSON  
I tried with that

```auto
msg.payload = msg.payload.replace(/\n/g," ");
return msg;

```

it does not work  
 ![aaa](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/1/017f90722c358564b3ba4acf011556eb6343ad79.png)

![bbbbb](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/6/36e9f220d201a8cc18326d1e0cda6d9979755d23.png)

---

<div class="post-metadata">

**Author:** ![cymplecy](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/cymplecy/32/2773_2.png) [@cymplecy](https://discourse.nodered.org/u/cymplecy)\
**Post date:** [20 November 2021 21:41 UTC](https://discourse.nodered.org/t/remove-space-string-node-red/54042/2 "2021-11-20T21:41:11Z")

</div>

Those arrows are tab characters \t not \n

---

<div class="post-metadata">

**Author:** ![Eucliwood090](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/eucliwood090/32/51369_2.png) [@Eucliwood090](https://discourse.nodered.org/u/Eucliwood090)\
**Post date:** [20 November 2021 21:48 UTC](https://discourse.nodered.org/t/remove-space-string-node-red/54042/3 "2021-11-20T21:48:13Z")

</div>

Oh, Perfect ^^. Impeccable.  
I would like to collect only the numbers.

But I can't use the payload ...

---

<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:** [20 November 2021 22:01 UTC](https://discourse.nodered.org/t/remove-space-string-node-red/54042/4 "2021-11-20T22:01:38Z")

</div>

> [@Eucliwood090](#):
>
> I would like to collect only the numbers.

In that case split the string on the tab characters and take the second element. [JavaScript String split() Method](https://www.w3schools.com/jsref/jsref_split.asp)

---

<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:** [19 January 2022 22:01 UTC](https://discourse.nodered.org/t/remove-space-string-node-red/54042/5 "2022-01-19T22:01:46Z")

</div>

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