How to extract specific text from the value?

Hi makers,

I’m a newbie and have a question to use functions.
For example, I have a value below.

  • 12345678 : This is a test value

In this value I just want to get number (12345678),
But I cannot think any of ways to extract only numbers.

Could you please help this?

Hey @Yong_Yun,

This is a somewhat advanced, but you can do this using regex. Simply use the text parser ‘Match pattern’ action, and use the expression [+-]?(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)? for the pattern to match and select the text you’d like to extract the numbers from in the ‘text’ field.


CleanShot 2022-07-28 at 08.19.41

Hope this was helpful!

3 Likes

Hi @NocodeNoah
That’s really helpful!

But I have another question…
It seems like this regex can extract all numbers in the value.

My next question is, what about this value?
In this value this regex works same?

  • Value : 12345678: This is 2 text value

Please help me. Thanks!

Hey @Yong_Yun,

CleanShot 2022-07-28 at 09.13.54

Yes, that should also work! I would encourage you to try different situations and see if this expression suits your needs. If you want a extract something else from a text, you can try https://regex101.com/ or https://regex-generator.olafneumann.org/ to help you find the right expression for your needs.

3 Likes

Hey @NocodeNoah ,

That’s really helpful, Thanks a lot!

2 Likes

I faced very similar problem but solved thanks for your guide.

Actually, I had put “[0-9]+” in the “pattern” box to find numbers from a text which is like you exampled, but failed.

  • 12345678 : This is a test value

Then I tried to copy&paste “[±]?(\d+(.\d+)?|.\d+)([eE][±]?\d+)?” to it and turned to be worked!!
But I’m still not sure why it did not work by putting “[0-9]+” as pattern.
The regex does not extract any floats or logarithms but it should pick up integer.

Sorry for basic question but I’m appreciated if you have any instruction.
Thanks!!
Yuji Yamanaka

1 Like