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 / Need to retrieve multi...
Power Automate
Suggested Answer

Need to retrieve multiple substrings from the email subject

(1) ShareShare
ReportReport
Posted on by 603
I have the below email subject. I need to retrieve the substring site address and postal code from the below subject. I have already retrieved the RBL number successfully.
 
May i know how to achieve this using Power automate?
 
Site address should be St Patricks Gardens and St Columbas Close, Gravesend
Postal code should be DA12 4AJ
 
Email Subject
RBL2113 - St Patricks Gardens and St Columbas Close, Gravesend, DA12 4AJ
 
Code to retrieve RBL Number
substring(item()?['Subject'], indexOf(item()?['Subject'], 'RBL'), 7)
 
I have the same question (0)
  • Valantis Profile Picture
    6,526 on at
     
    just need to tell Power Automate where each piece starts and how long it is.

    For the site address, paste this into a Compose or whatever field you're using:

    substring(item()?['Subject'], add(indexOf(item()?['Subject'], ' - '), 3), sub(sub(length(item()?['Subject']), 10), add(indexOf(item()?['Subject'], ' - '), 3)))
    It finds the ' - ' in the subject, jumps 3 characters past it (that's where the address starts), then works out the length by stripping off ', DA12 4AJ' from the end.

    For the postal code:
    substring(item()?['Subject'], sub(length(item()?['Subject']), 8), 8)
    This just grabs the last 8 characters. DA12 4AJ is 8, so it works cleanly.
    if you ever get subjects with a shorter postcode (some UK postcodes are 7 or 6 characters) you'd need to change that 8. For your current format you're fine.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

     

  • Suggested answer
    11manish Profile Picture
    3,038 on at
    Since your subject has a consistent pattern, you can extract each part using string functions in Microsoft Power Automate.
     
    Given Subject
    RBL2113 - St Patricks Gardens and St Columbas Close, Gravesend, DA12 4AJ
     
    Structure:
    • [RBL] - [Site Address], [Postal Code]
    1. Extract Site Address
    Logic:
    • Starts after " - "
    • Ends before last comma (postal code part)
    • Expression
    trim(
      substring(
        item()?['Subject'],
        add(indexOf(item()?['Subject'], ' - '), 3),
        sub(
          lastIndexOf(item()?['Subject'], ','),
          add(indexOf(item()?['Subject'], ' - '), 3)
        )
      )
    )

    Output
    • St Patricks Gardens and St Columbas Close, Gravesend
    2. Extract Postal Code
    Logic:
    • Everything after the last comma
    • Expression
    trim(
      substring(
        item()?['Subject'],
        add(lastIndexOf(item()?['Subject'], ','), 1),
        sub(
          length(item()?['Subject']),
          add(lastIndexOf(item()?['Subject'], ','), 1)
        )
      )
    )

    Output
    • DA12 4AJ
    Thanks
    Manish
  • Valantis Profile Picture
    6,526 on at

    Hi @Iantaylor2050,

    Just wanted to check in and see if everything is working now. If you still need any help, feel free to let me know.

    Also, if the issue is resolved, it would be great if you could mark the answer as solved so others with the same question can find it easily.

     

    Thanks and have a great day!

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Valantis Profile Picture

Valantis 462

#2
Vish WR Profile Picture

Vish WR 256

#3
David_MA Profile Picture

David_MA 242 Super User 2026 Season 1

Last 30 days Overall leaderboard