Power Automate Flow that return numbers on a text


Hi Folks,
Have you had this kind of requirement? Where you have to get all the numbers that exist on a text.
I recently created a child flow with Power Automate that does this in 11 seconds.




First, you must create a variable to append all numbers in this string.


The next step is to split your text by space, but first, you need to remove possible characters that can be next to the numbers f.e. "$" or ","

split(replace(replace(triggerBody()['text'],',',''),'$',''),' ')


Next, per each record, you will validate if it is an int or float number, and if yes, it will be appended to the variable.

if(or(isFloat(item()),isInt(item())),concat(item(),'|'),'')

Finally, remove the last string that concatenates each number "|" and return it as the flow result.

substring(variables('numbers'),0,sub(length(variables('numbers')),1))

The expected result of the following input is: "4|4.59|2"















Comments

Popular posts from this blog

Portal (Power Pages) WebAPI & forget about clearing cache

Data Migration Toolbox

Using external Fonts in Power Pages