Filter Numbers from String

Hello, Im trying to filters numbers from a string node, like:

set:
name = 123123 - Alex

I want to create a VAR or other String with only numbers from ‘name’
name-numbers = 123123

It’s possible?

Hey @Alexandre_Magno!

This is possible using Regex.

The following workflow illustrates this. The Regex that I am using may not cover all the use-case. You can use Regex101 to build these Regex and use them in the workflow.

The more generic version, which simply returns the first number found, would be:

{{ $json["Name"].match(/\d+/g)[0] }}
1 Like