Power Automate  

How to Extract Numbers from Any String in Power Automate

Introduction

Sometimes in Power Automate, we get text that has both words and numbers mixed together. But many times, we only need the number part from that text. In this article, I will show a very simple way to extract numbers from any string in Power Automate.

Use Case

When you get an order number or invoice text like “Order12345” from a form or email. You may need only 12345 to store it, compare it, or use it in calculations. In such cases, extracting numbers from the text becomes very useful in Power Automate.

Prerequisites:

  • Basic knowledge of creating and using flows in Power Automate

  • Basic understanding of variables, Compose, Select, and Filter array actions.

Below are the steps to extract numbers from any string:

Step 1

Go to make.powerautomate.com, open Power Automate, and create a new Manually triggered flow.
(As per your requirement, you can choose any trigger that fits your scenario.)

TitleFlow

Step 2

Add an Initialize variable action and give it any name you prefer. Set the Type to String and provide the value that contains the text. In this example, I am using a variable, but you can also use any dynamic content based on your scenario.

15-12-2025-06-13-32

Step 3

Select From Value:

chunk(variables('varString'),1)

If you don't know how the chunk() function works, I have already explained it in a very simple way in my blog. You can check it out here.

Link: Chunk() function in powerautomate

Map value:

if(isInt(item()),item(),null)
15-12-2025-06-18-40

In the From field, I used the chunk() function to split the string into individual characters.

Then, while mapping the value, I applied a condition that checks whether the current character is a number. If it is a number, it keeps the value; otherwise, it returns null.

So in the output, you get numbers where they exist, and null values for all other characters.

Step 4

Add Compose action and pass input as per below

join(body('Select'),'')
15-12-2025-06-22-30

This formula joins all values from the Select output and automatically skips the null values.

Step 5

Add another compose action and in this step we are just converting value from text to a number.

int(join(body('Select'),''))
15-12-2025-06-25-59

Output

Save the flow ,run it and check the output.

15-12-2025-06-29-57

Another approach using Filter array:

Step 1

Add Filter Array action

From: chunk(variables('varString'),1)
Condition: isInt(item()) is equal to true

15-12-2025-06-31-13

In the From field, I used the chunk() function to break the string into single characters.

Then, I added a condition to check whether each character is a number.

This way, it keeps only the numbers and ignores everything else.

Step 2

Add compose action and pass input as per below

join(body('Filter_array'),'')
15-12-2025-06-38-23

This joins all the values coming from the Filter array output into a single string without any separator.
Since the Filter array already contains only numeric values, this step combines them together to form one number, like 1254312323

Output

Save the flow and run it, and you will see that it returns only the numbers from the string.

15-12-2025-06-41-07

Conclusion

In this article, we learned how to quickly extract numbers from any string. Just split, filter, and join the numbers - easy and straightforward.