cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Extract email from string

Hello,

 

I want to extract email id from a string. 

I will have multiple emails.

 

<div class="ExternalClass9E13B"><div style="font-family&#58;Calibri, Arial, Helvetica, sans-serif;font-size&#58;11pt;color&#58;rgb(0, 0, 0);"><span style="color&#58;black;">​</span>abc@gmail.com; sac@gmail.com</div></div>

 

I need to get: abc@gmail.com; sac@gmail.com

                       

 

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous ,

I had another go at this, but note this will only work if you have a consistent number of ">" symbols before the emails (I have used 3 here - the email/s are the fourth split) and a ">" symbol directly after.

With(
   {
      wSplit: 
      Last(
         FirstN(
            Split(
               YourHTMLText,
               ">"
            ),
            4
         ).Result
      ).Result
   },
   Left(
      wSplit,
      Find(
         "<",
         wSplit
      ) - 1
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

14 REPLIES 14
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Like this

First(
   Split(
      Last(
         Split(
            YourText,
            "</span>"
         )
      ).Result,
      "</div>"
   )
).Result

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Anonymous
Not applicable

Hello,

 

Thank you for the reply.

This formula doesn't work for a single email id.

 

Single email :

<div class="ExternalClass2B"><div style="font-family&#58;Calibri, Arial, Helvetica, sans-serif;font-size&#58;11pt;color&#58;rgb(0, 0, 0);"><span style="color&#58;black;">​pp@gmail.com</span><br></div></div>

 

Multiple emails:

<div class="ExternalClas17"><div style="font-family&#58;Calibri, Arial, Helvetica, sans-serif;font-size&#58;11pt;color&#58;rgb(0, 0, 0);"><span style="color&#58;black;">​</span>ab@gmail.com;sn@gmail.com</div></div>

 

Thank you.

 

 

 

 

@Anonymous ,

Thanks for the Kudo - is this now solved?

Anonymous
Not applicable

Hello,

 

Nope as i mentioned in my previous reply.

The formula u have suggested applies for only multiple mails but not single mail.

 

Please help me on this.

 

Thanks.

@Anonymous .

That was not the code you posted - the single one has a different span code before and a different code after it - you cannot do this without consistent code before and after the emails.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

@Anonymous ,

I had another go at this, but note this will only work if you have a consistent number of ">" symbols before the emails (I have used 3 here - the email/s are the fourth split) and a ">" symbol directly after.

With(
   {
      wSplit: 
      Last(
         FirstN(
            Split(
               YourHTMLText,
               ">"
            ),
            4
         ).Result
      ).Result
   },
   Left(
      wSplit,
      Find(
         "<",
         wSplit
      ) - 1
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Anonymous
Not applicable

Can we get it by using "@gmail.com" in the formula ?

 

Thanks.

StalinPonnusamy
Super User
Super User

Thanks, @WarrenBelz providing the formula/code.

 

Hi @Anonymous By Looking at the Div tag, looks like you need to extract email id's from the Power Automate.

If this is true please post your question to the Power Automate forum and tag me. So that I can post my answer over there and help others in the future. 

 

Example (Extracted emails)

StalinPonnusamy_0-1629044110576.png

 

@Anonymous ,

You did not say it was always going to be gmail.com (my brain hurts enough doing the last two). I had a bit of a go, but you still need to allow for one or many email addresses (I assume) and they have different things before and after them if you split at gmail.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,748)