Need to extract phone number from email body

Hi All,
I want to extract phone number from the email body .
This phone number can be in different patterns like

(123) 258-8978 or (123) 258 8978 or 123 258 8978
This phone number can be anywhere in the email body.
Please take any sample email there is no standard format.
Thank you

Hi @deepaksvg99

\(?\d{3}\)? \d{3} ?\-?\d{4}
Use this regular expression

1. For each email
2. Assign body = currentMail.body
3. Assign number = System.Text.RegularExpressions.Regex.Match(body, "\(?\d{3}\)? \d{3} ?\-?\d{4}").Value

Hope it helps.

Try to extract the phone number using regex.
one of the regex pattern would be this
image
[0-9 ()-]+

1 Like

Hi @deepaksvg99

Regards

1 Like

Hi @deepaksvg99

Try this

image

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.