How to extract Email/ Phone Number from a text

I want to extract text from a website, and the length of the text is dynamic(2 to 3 paragraphs), If the extracted text has some Email or phone number provided I want to save that Email/ Phone No. in an Excel Sheet.

How should I approach this?

"Für Rückfragen kontaktieren Sie bitte

Lars Bode
+49 (0) 30 | 577 1401 11
karriere@berlintxl.de

Wir freuen uns auf Ihre vollständigen Bewerbungs­unterlagen unter Angaben Ihrer Gehalts­vorstellung und Ihres frühest­möglichen Eintritts­termins."

For example in this paragraph I have used RegEX to extract Email but there is one issue that it is taking 11 from the previous line and Wir from the next line and giving me this Email

11karriere@berlintxl.deWir
Also for the Number same issue.

Hi @Sami_Rajput

Add the following to your regex pattern for the email:
Very end insert:
[\r\n]+

Very start add this:
^

Please share you regex pattern and we can update it.

What are you using for the phone number? Can you you share some samples?

Cheers

Steve

Hi @Sami_Rajput

Can you try this-

The regular expressions or string manipulation functions to search for email addresses and phone numbers within the extracted text. You can use the “Matches” activity or the “IsMatch” function to check if a text matches a specific pattern. For example, you can use regular expressions like \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b to identify email addresses.

Thanks!!!

@Sami_Rajput

Try this

Number - Sytem.Text.RegularExpressions.Regex(str,"\n[\d\s\+()|]+\n").Value

Email - Sytem.Text.RegularExpressions.Regex(str,"\n[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\n").Value

Hope this helps

Cheers

@Nitya1
I used this RegEX and got this Email

karriere@berlintxl.deWe

We is included from the next line still

@Anil_G
I have used the same expression

Regex.Match(Description,“\n[A-Za-z0-9._%±]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}\n”).value

but getting no output
also for the phone number no output

@Steven_McKeering
I am able to remove the 11 from the previous line using this expression by @Nitya1 but still, there is “We” included from the next line

This is the RegEx i have used for Phone No. and that is working fine

“Phone No. is”&Regex.Match(Description,“+49\s?(0)\s?\d{2,}(?:\s|\s)?\d+\s\d+\s\d+”).ToString

Hey!

Try this:

If you want to extract only Mobile number you can do this:

strMobileNumber = System.Text.RegularExpressions.RegEx.Match(StrInputVariable,"\+\d.*(?<=\d{2})").ToString.Trim

Reference:

If you want to extract only Email you can do this:

strEmail = System.Text.RegularExpressions.RegEx.Match(StrInputVariable,"[A-Za-z]{1,}.+@(?>[A-Za-z]{1,}.+)").ToString.Trim

Reference:

Regads,
NaNi

Hi @Sami_Rajput

You can extract the data by using the Regex Expressions. Check the below regex for mail and phone number extraction.
Mail Regex code -

Phone number code -

I hope it will help you @Sami_Rajput !!