cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
cckiat9999
Frequent Visitor

How do I extract email address from a string?

Hi, what is the best way to search and extract an email address from a string? Thanks!

 

Sample String:

I am Peter Watts from ABC Co. Ltd. and my email address is pw@abc.com while my phone number is 123-345-567.

1 ACCEPTED SOLUTION

Accepted Solutions
PowerAddict
Super User
Super User

Hi @cckiat9999
I am sure there is a better way to do it but if your text will have only one email address, then you can use this: 

Last(Split(First(Split("Your Text", "@")).Result, " ")).Result & "@" & First(Split(Last(Split("Your Text", "@")).Result, " ")).Result

Let me know if this helps. I will try to come up with a better/cleaner approach. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Microsoft Certified Trainer MCT

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

View solution in original post

3 REPLIES 3
PowerAddict
Super User
Super User

Hi @cckiat9999
I am sure there is a better way to do it but if your text will have only one email address, then you can use this: 

Last(Split(First(Split("Your Text", "@")).Result, " ")).Result & "@" & First(Split(Last(Split("Your Text", "@")).Result, " ")).Result

Let me know if this helps. I will try to come up with a better/cleaner approach. 

 

---
If you like this reply, please give kudos (Thumbs Up). And if this solves your problem, please mark this reply as a solution by selecting Accept as Solution. This makes it easier for others to find answers to similar questions. 

 

Thanks!

Hardit Bhatia

Microsoft Business Applications MVP

Microsoft Certified Trainer MCT

Blog | Twitter | LinkedIn | Facebook | YouTube  |  Email

View solution in original post

Thanks, Hardit. This works well. I was thinking if 'Match' function is able to do something similar, since 'Match' and its enum Match.Email is able to tell if there is an email address within the string. Cracked my head for hours and decided to use your way 🙂 Thank you!

Glad I could help! Good luck with the rest of your app! Feel free to reach out in case of any questions!

Thanks,
Hardit Bhatia
The Power Addict
https://thepoweraddict.co

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,375)