cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mdemarici123
Frequent Visitor

How can I extract a number in between two different characters in power automate?

 

Hi All, 

 

I am trying to use power automate to extract the numbers underlined below. I am lost on how to do so. As you can see the number will always be in between a dash and an underscore and the number could be either 3, 4, or 5 digits. Also sometimes there is another iteration of text in between the dash and underscore like in the project yellow document. I think I need to use Regular Expressions, but I am completely lost. 

 

Thank you in advance,

 

Marcus 

 

Mdemarici123_0-1640025370496.png

 

 

4 REPLIES 4
ScottShearer
Super User
Super User

@Mdemarici123 

You can use a split() action if all of the following are true:

  1. There is always a dash preceding the number
  2. There is always an underscore after the number
  3. There will never be more than one dash or there will always be the same number of dashes
  4. There will never be more than one underscore or there will always be the same number of dashes

In other words, there needs to be a pattern.

If all of the above are true, see my example below, let me know and I will provide an example.

 

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
Mdemarici123
Frequent Visitor

Hi @ScottShearer  unfortunately there will not be a constant pattern, the only difference will be the situation in the above picture in "project yellow" I was curious to see if there is a way to tell flow to get a number and only a number that is in between the dash and the underscore. 

VictorIvanidze
Community Champion
Community Champion

Hi @Mdemarici123, than you have to use something like this:

https://powerusers.microsoft.com/t5/Building-Flows/How-to-know-if-an-variable-is-numeric/td-p/565181

--------------------------------------------------------------------------------------
Contact me if you are interested in custom Power Automate development.
ScottShearer
Super User
Super User

@Mdemarici123 

See my example below and give it a try.  Please let me know if this works for you.

image.pngimage.png

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Users online (4,851)