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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to extract ONLY nu...
Power Automate
Unanswered

How to extract ONLY numbers from string

(0) ShareShare
ReportReport
Posted on by

Hi, I have free text column in Dataverse table where alphanumberic values are entered e.g. abc123, 123abc,1abc23. I want to extract ONLY  numbers and discard letters using Power Automate. How to do it? I google a lot but no luck. I found solution here but its not efficient solution at all. Please guide

Categories:
I have the same question (0)
  • bshoyat Profile Picture
    24 on at

    Hi, 

    Since you strings can contain number anywhere in the string, the best solution i can think of if a really long expression that uses replace. The good news is that you will need to type it once and you can copy it for future uses. But it would look something like this: 

    replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(toLower('12Ab2aC123'), 'a', ''), 'b', ''), 'c', ''), 'd', ''), 'e', ''), 'f', ''), 'g', ''), 'h', ''), 'i', ''), 'j', ''), 'k', ''), 'l', ''), 'm', ''), 'n', ''), 'o', ''), 'p', ''), 'q', ''), 'r', ''), 's', ''), 't', ''), 'u', ''), 'v', ''), 'w', ''), 'x', ''), 'y', ''), 'z', '')

    the resulting string is "122123"

     

    Might not be the prettiest solution, but very efficient. You can also add new characters like to be replaced

     

  • Ellis Karim Profile Picture
    11,983 Super User 2026 Season 1 on at

    Hi @chintan12345 ,

     

    There are now two relatively "new" functions that you could try: Slice() and IsInt() 

     

    For example:

    Snag_176dff5d.png

     

     

    SELECT
    
    range(0, length(variables('varData')))
    if(isInt(slice(variables('varData'),item(), add(item(),1))),slice(variables('varData'),item(), add(item(),1)), '')
    
    
    COMPOSE
    
    join(body('Select'),'')

     

     

    [updated] The Substring() function seems to work also and looks cleaner:

    SELECT using substring()
    
    range(0, length(variables('varData')))
    if(isInt(substring(variables('varData'),item(), 1)), substring(variables('varData'),item(), 1),'')

     

    Ellis
    ____________________________________
    If I have answered your question, please mark the post as ☑️ Solved.
    If you like my response, please give it a Thumbs Up.
    My Blog Site

  • Chriddle Profile Picture
    8,672 Super User 2026 Season 1 on at

     

    Chriddle_0-1676901032201.png

    NumberArray: Select action

    From:

     

    chunk(outputs('MixedString'), 1)

     

    Map:

     

    if(contains('0123456789', item()), item(), '')

     

     

    NumberString: Compose action

     

    join(body('NumberArray'), '')

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 557

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 264 Super User 2026 Season 1

Last 30 days Overall leaderboard