Skip to main content

Notifications

Power Automate Desktop
Suggested answer

How to split a text using 'delmiter _'

Posted on by 24
Hi,
I have an expression from which I need to extract a specific value using the delimiter '_'.
The extracted text is:-
"Split_1.pdf"
And the text we need to extract from it is only '1'.
How would anyone be able to do it?
Categories:
  • Suggested answer
    eetuRobo Profile Picture
    eetuRobo 1,801 on at
    How to split a text using 'delmiter _'
    Better way might be to use Parse text -action to just get the number without needing to split it into a list. So you get the number with just one action when using regex that finds the number between underscore and .pdf

    Text to find (regex): (?<=_)\d+(?=\.pdf)
    Is regular expression 
    Toggled on


    Then Match variable has the number inside it:


    ​​​​​​​
    If you want to do this with split action:
    Change "Delimeter type" to be "Custom" and then add to "Custom delimeter field "_" like so:
     
    Then you get [Split, 1.pdf]
     
    Then you could use replace on the second item on the list which s %TextList[1]% and text to find .pdf and replace with %''% (empty string)
     
    Result is 1
  • Suggested answer
    How to split a text using 'delmiter _'
    Use split() Function:
    First, split the text by the _ delimiter, which will give you an array with two elements: "Split" and "1.pdf".
    Use another split() to remove .pdf
    Then split the second part "1.pdf" using the . delimiter to extract the value 1.
     
    split(split('Split_1.pdf', '_')[1], '.')[0]
     

Helpful resources

Quick Links

Welcome to the Power Platform…

We are thrilled to unveil the newly-launched Power Platform Communities!…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 140,719

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,355

Leaderboard