RegEx: Extracting Email via Text Formatter > Extract Pattern

Status: Closed · Asked by clsops on · 0 views

clsops — Question ·

Hello Pabbly Staff,

Problem: I am unable to extract email via RegEx
Goal: Extract email and forward the email body to said email

1. Tawk chat transcript is received through Email Parser.
2. I would like to extract the email
3. Forward the transcript to the email extracted from step 2

I tried the two expressions below at RegExr: https://regexr.com/ - however, neither match.

^([\sa-z\d\.-]+)@([a-z\d-]+)\.([a-z]{2,8}\s)(\.[a-z]{2,8}\s)?$

^([a-z\d\.-]+)@([a-z\d-]+)\.([a-z]{2,8})(\.[a-z]{2,8})?$

Conversation started on Tuesday, February 15 2022, 15:48 ================================================================ [15:48] Visitor navigated to Visitor navigated to [15:50] 4-8PM SHIFT (TEST) : [email hidden] [15:50] Customer Support (System Message) : Hello, thank you for your visit. 

As a temporary solution, I tried to use Body Html > Text Parser :
After:


Before:
">

This can extract the first email, but not any other emails contained in the text.

For Staff, my workflow is: https://connect.pabbly.com/workflow/mapping/IjI1NTk5NyI_3D

Praveen — Reply ·

@clsops Try this expression:

\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b

clsops — Reply ·
\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b

Hi Praveen, it didn't work for me. Can you try testing with this text body to see if it works for you:

Conversation started on Tuesday, February 15 2022, 15:48 ================================================================ [15:48] Visitor navigated to Visitor navigated to [15:50] 4-8PM SHIFT (TEST) : [email hidden] [15:50] Customer Support (System Message) : Hello, thank you for your visit.
Fagun Shah — Reply ·

Hi Praveen, it didn't work for me. Can you try testing with this text body to see if it works for you:

Conversation started on Tuesday, February 15 2022, 15:48 ================================================================ [15:48] Visitor navigated to Visitor navigated to [15:50] 4-8PM SHIFT (TEST) : [email hidden] [15:50] Customer Support (System Message) : Hello, thank you for your visit.

Try this - ([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)

Fagun Shah
- Automation Freelancer
- Let's Connect - https://www.facebook.com/fagun.shah.7/
Fagun Shah — Reply ·
Hi Praveen, it didn't work for me. Can you try testing with this text body to see if it works for you:

Try this - ([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)


Or here is another one -

[a-z0-9!#$%&'*+/= ^_`{|}~-]+( :\.[a-z0-9!#$%&'*+/= ^_`{|}~-]+)*@( :[a-z0-9]( :[a-z0-9-]*[a-z0-9]) \.)+[a-z0-9]( :[a-z0-9-]*[a-z0-9])

Fagun Shah
- Automation Freelancer
- Let's Connect - https://www.facebook.com/fagun.shah.7/
Pabblymember11 — Reply ·

Hey @clsops

To extract email addresses from the text you can use " Text Formatter by Pabbly: Text (Basic Formatting) ".

clsops — Reply ·
To extract email addresses from the text you can use " Text Formatter by Pabbly: Text (Basic Formatting) ".

OMG! Thank you, Supreme! This is so much simpler!

Thank you for your help as well Fagun, appreciate your input!

[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])

^ This one is perfect, it can extract full email and all of them!
Try this - ([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)

^ PS This one does not work properly, for example, "[email hidden]" > "[email hidden]"
Praveen — Reply ·

@clsops @Fagun Shah

Hi Praveen, it didn't work for me. Can you try testing with this text body to see if it works for you:
Conversation started on Tuesday, February 15 2022, 15:48 ================================================================ [15:48] Visitor navigated to Visitor navigated to [15:50] 4-8PM SHIFT (TEST) : [email hidden] [15:50] Customer Support (System Message) : Hello, thank you for your visit.

Yes, the expression I posted worked for me. But remember there are many flavors of regex and you might need to modify it slightly depending on where you are using it. But for this particular case, the solution posted by @Supreme is supreme. ?

Back to all forum threads · Log in to reply