web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Getting substring out ...
Power Automate
Unanswered

Getting substring out of a string in PowerAutomate to find a digit/number

(0) ShareShare
ReportReport
Posted on by 68

Hi all,

 

Had a similar question before, but now there's a new requirement. I'm building this Flow that needs to rename a created document before it gets moved to a folder. Couldn't find what I'm looking for in here, so posting a new topic for it. I'm trying to get everything before the number of the document. For example, out of the string 'BugsBunny-Arn-999999-67378-CLMPDVVD-TB-GN.docx', I'm trying to make it to be only '999999-67378-CLMPDVVD-TB-GN.docx', need to make it look for a number/digit, remove everything before it and leave the name with what's left out of the string. What is the correct expression that will work? Have in mind that'd be a dynamic value, so I'm basically taking the Name of the file first and then need to convert it to have only what is after the first digit/number, with the first digit included of course. Thank you!

Categories:
I have the same question (0)
  • Paulie78 Profile Picture
    8,422 Moderator on at

    filename.png

    join(skip(split(outputs('fileName'),'-'),2),'-')
  • benny_blanco Profile Picture
    68 on at

    Hi @Paulie78 ,

     

    Is this going to look for a number within the string and remove everything before it, or is it going to remove everything after the second "-" character? As I need it to look for a digit/number and to remove everything before it. The digits might start and be after the second "-" character, they might be after the third, fourth etc., it needs to look for the first digit within a dynamic string/name value and remove everything before it. Thank you!

  • Paulie78 Profile Picture
    8,422 Moderator on at

    Everything after the second - character.

  • benny_blanco Profile Picture
    68 on at

    This wouldn't work in this case, as the digits might start after the third, fourth character etc. Need it to find the first digit in the string and remove everything before it, any idea how to achieve that? Thank you!

  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    Much more difficult and messy, but you can do it like this:

    https://ibb.co/w4cfJD7 

    filename2.png

    The expression in IsItLess is:

    if
    (
     equals(outputs('NumberPositionInFileName'), -1),
     variables('numberPos'),
     if
     (
     less(outputs('NumberPositionInFileName'), variables('numberPos')), 
     outputs('NumberPositionInFileName'), 
     variables('numberPos')
     )
    )
  • Paulie78 Profile Picture
    8,422 Moderator on at

    That screenshot isn't clear. Use this one:

    https://ibb.co/pfZbznB

  • benny_blanco Profile Picture
    68 on at

    Thank you! Will give it a try and let you know.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard