Extracting email address using regex
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello!
There are some solutions out here already, but I can't quite get mine to do exactly as needed.
I am trying to extract an email, and on occasion there is more than one, but also another email address I don't want. Data would look something like this:
Email Address: sjefferson@gmail.com
(1) Beneficiary Name: John Smith
(1) Beneficiary Street Address: 123 Main St
(1) Beneficiary Street City: Anytown
(1) Beneficiary Email: jsmith@gmail.com
(2) Beneficiary Email: ljones@aol.com
Results I need are jsmith@gmail.com and ljones@aol.com But, NOT the sjefferson@gmail.com
I tried: Beneficiary email:(.+@\w+[\.\w?]+)
But that would only pull 1 email and if the one labeled Email Address was listed first, it pulled that one.
Thank you in advance,
Kim
Solved! Go to Solution.
- Labels:
- Regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Try this out!
Email:\s(.+)
Its taking all characters after Email: -- side note here, the website regex101 is a very helpful resource as you're testing out your regex
If this provided a solution, make sure to mark it as solution to help other members out!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@kas ,
As @CarliE pointed out, you can simplify your expression to pick up all of the emails. The reason your expression isn't working for the first email address is the word "Beneficiary" in the expression. If you simplify it to just look for the word email and add .* before the : , you will pick up all three. Try this modified expression:
Email.*:\s(.+@\w+[\.\w?]+)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hey @kas,
Not sure how your data is structured but here's two examples of how I would get the email addresses:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hello,
Thank you for the quick response...I should have added a bit more to my data set - your Regex pulled too much.
Email Address: sjefferson@gmail.com
(1) Beneficiary Name: John Smith
(1) Beneficiary Street Address: 123 Main St
(1) Beneficiary Street City: Anytown
(1) Beneficiary Email: jsmith@gmail.com
(2) Beneficiary Email: ljones@aol.com
(1) Amount: $xxx
(2) Amount: $xxx
Etc...there is more misc stuff afterwards...
thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, sorry it wasn't clear in my original question...I only want the ones that start with Beneficiary.
Thank you!
Can't find the option to edit my original question...sorry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@kas my solution should give you what you need :)
Let me know if you have any questions and be sure to mark the solution!
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Yes, but I don't want everything after the email address...there is additional information and the emails aren't listed one after the other.
Thank you though.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Email:\s(\w+@\w+.\w+)
This new solution didnt work?
1. Add a record ID
2. Split to rows with \n delimiter
3. Regex Parse with the expression above
4. Filter out nulls if needed
