Skip to main content

Notifications

Community site session details
Power Automate - Building Flows
Answered

Extract text between two / symbols

Like (0) ShareShare
ReportReport
Posted on 1 Feb 2024 06:09:34 by 2

Hi All, 

 

I am trying to extract text from a certain position in a string. 

I need to get any text between the last two / symbols (eg 'extraction)

 

https://webaddress.com/extracttion/

 

Can anyone help?

 

Thank you!

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 01 Feb 2024 at 10:17:36
    Re: Extract text between two / symbols

    Hi @Chriddle 

     

    Thanks for sharing. New learning for me 🙂

     

     

  • Verified answer
    Chriddle Profile Picture
    7,685 Super User 2025 Season 1 on 01 Feb 2024 at 09:22:52
    Re: Extract text between two / symbols

    Althoughthere is already a good solution provided by @ManishSolanki (and I would go for it), I want to show another easy way:

    slice(
    	'https://webaddress.com/extracttion/',
    	add(nthINdexOf('https://webaddress.com/extracttion/', '/', -2), 1),
    	nthINdexOf('https://webaddress.com/extracttion/', '/', -1)
    )

    You can find the last positions in a string by using negative numbers as occurrence in nthIndexOf().

    nthIndexOf('<text>', '<searchText>', <occurrence>)

     

  • Verified answer
    ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 01 Feb 2024 at 06:28:35
    Re: Extract text between two / symbols

    Hi @kajelliott 

     

    Pls use the expression to extract the required text:

    ManishSolanki_0-1706768818482.png

    Below expression needs to bs added in the expression box as highlighted in the above screenshot:

    trim(join(take(reverse(split('https://webaddress.com/extracttion/','/')),2),''))

     

     

    Output:

    ManishSolanki_1-1706768895217.png

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

  • Verified answer
    v-jefferni Profile Picture
    on 01 Feb 2024 at 06:27:14
    Re: Extract text between two / symbols

    Hi @kajelliott ,

     

    Please try the expression:

    first(reverse(take(split(outputs('Compose'), '/'),sub(length(split(outputs('Compose'), '/')),1))))

    vjefferni_0-1706768822392.png

     

    Best regards,

  • KE_WSG Profile Picture
    2 on 01 Feb 2024 at 06:10:10
    Re: Extract text between two / symbols

    forgive the spelling - i was in a rush!

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,743 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,079 Most Valuable Professional

Leaderboard
Loading started
Loading started
Loading complete