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 Automate
Unanswered

Flow

(0) ShareShare
ReportReport
Posted on by 17

I need a help to extract texts which contains _ from email

 

 

sample email : 

 

Hello

 

Billing date is due for this month. Please find the servies below 

 

GYO_PL6801_HD_YTO

KY_YO_HHS_GY_9610

 

Thanks,

 

Categories:
I have the same question (0)
  • v-mengmli-msft Profile Picture
    on at

    Hi @KNAR ,

     

    If this is a fixed-format email sent to a customer, then you can use the following method to get the text containing '_'.

    1/My test email.

    vmengmlimsft_1-1711281659595.png

    2/Flow.

    vmengmlimsft_2-1711281745427.png

    first(split(last(split(outputs('Html_to_text')?['body'],outputs('Compose_2'))),'Thanks'))

    3/Result of test.

    vmengmlimsft_0-1711281611930.png

     

    The above method results in the text containing '_' by cutting the line break in the body and 'Thanks'.

     

     

     

    ——————————————————————————————————————————————

    If my answer helps you solve the problem, please accept it as a solution.

     

    Best regards,

    Rimmon

  • KNAR Profile Picture
    17 on at

    @v-mengmli-msft @Unfortunately its not a fixed format we do have separate format for other emails but services has fixed text containing _ 

    so is it possible to extract the text which contains _  

    And services 1  - 50  which may vary based on the email, so if its extracting based on the _ will be useful 

     

     

    thanks

     

  • KNAR Profile Picture
    17 on at

    @jibbs @abm 

  • Verified answer
    Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    Chriddle_0-1711356908711.png

     

    Select From:

    split(
    	replace(
    		outputs('Compose'),
    		decodeUriComponent('%0A'),
    		' '
    	),
    	' '
    )

     Map:

    if(
    	contains(item(), '_'),
    	item(),
    	''
    )

     

    Filter:

    @greater(length(item()), 0)

     

    Chriddle_1-1711356999178.png

     

  • jibbs Profile Picture
    84 on at

    Hi @KNAR , give @Chriddle's solution a try. If you still face any issues, you could try the AI Builder action to extract the text, but keep in mind that that solution requires premium PA license with limitations on AI Builder action credits. 

  • Verified answer
    Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    Even simpler:

    Chriddle_0-1711536587288.png

    From

    split(
    	replace(
    		outputs('Compose'),
    		decodeUriComponent('%0A'),
    		' '
    	),
    	' '
    )

    Filter

    @contains(item(), '_')

  • KNAR Profile Picture
    17 on at

    hey @Chriddle  thanks above solutions works could you please help me with the solution for the below 

    As im trying to post this result in the group chat 

    while i am getting ouput as the below 

     

    ["GHYWI_YWHD_NAT_68901_0","YUPLE_HU_MJU_561803uh_0","UTWNJ_UGW_6820_Y"]

     

    BUT Need a output like the below 

     

    "GHYWI_YWHD_NAT_68901_0",

    "YUPLE_HU_MJU_561803uh_0",

    "UTWNJ_UGW_6820_Y"]

     

     

     

  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    I don't get it.

    Your proposed output looks strange.

     

     

  • KNAR Profile Picture
    17 on at

    Requirement is to paste a every result as anew line delimiting “ , “

  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    Here are 2 options:

    1. If you want to keep it as JSON, stringify the array and add new-lines
    2. If you just want to list the values, join the array

    If you need a HTML new-line, replace decodeUriComponent('%0A') with '<br>'

     

    Chriddle_1-1711542460514.png

    replace(
    	string(body('Filter_array')),
    	',',
    	concat(',', decodeUriComponent('%0A'))
    )
    join(
    	body('Filter_array'),
    	decodeUriComponent('%0A')
    )

     

    Chriddle_2-1711542871666.png

     

     

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard