# Extract number from a string

**URL:** <https://discourse.nodered.org/t/extract-number-from-a-string/58265>\
**Category:** General\
**Created:** [13 February 2022 14:33 UTC](https://discourse.nodered.org/t/extract-number-from-a-string/58265 "2022-02-13T14:33:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigmac5753](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bigmac5753/32/15733_2.png) [@bigmac5753](https://discourse.nodered.org/u/bigmac5753)\
**Post date:** [13 February 2022 14:33 UTC](https://discourse.nodered.org/t/extract-number-from-a-string/58265/1 "2022-02-13T14:33:53Z")

</div>

I want to get a folder's size using the du command in exec node.  
The expanded debug output is:

```auto
18019844	/mnt/8tb2/sia

```

The collapsed debug output is:

```auto
18019844->/mnt/8tb2/sia

```

I've tried a function node with:

```auto
msg.payload = msg.payload.split("/mnt")[0];

```

But it returns the number with the arrow:

```auto
18019844->

```

I'm not sure what the arrow between the number and path means, i'm guessing tab but don't know how to include it in `msg.payload.split` to correctly format the number.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [13 February 2022 14:39 UTC](https://discourse.nodered.org/t/extract-number-from-a-string/58265/2 "2022-02-13T14:39:39Z")

</div>

In a function node...

```auto
msg.payload = parseInt(msg.payload);
return msg;

```

---

<div class="post-metadata">

**Author:** ![bigmac5753](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bigmac5753/32/15733_2.png) [@bigmac5753](https://discourse.nodered.org/u/bigmac5753)\
**Post date:** [13 February 2022 15:06 UTC](https://discourse.nodered.org/t/extract-number-from-a-string/58265/3 "2022-02-13T15:06:40Z")

</div>

perfect, thanks.

---

<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:** [14 April 2022 15:07 UTC](https://discourse.nodered.org/t/extract-number-from-a-string/58265/4 "2022-04-14T15:07:28Z")

</div>

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