How to extract only email address from string

hi i want to extract only email address

“your input is arun@gmail.com, and the following email like rams@gmail.com and explain shaym@gmail.com

Hi @anand_kumar4

Use assign with below expression:

emails = System.Text.RegularExpressions.Regex.Matches(inputText, “\b[A-Z0-9._%±]+@[A-Z0-9.-]+.[A-Z]{2,}\b”, RegexOptions.IgnoreCase).Cast(Of Match).Select(Function(m) m.Value).ToList()

If helpful, mark as solution. Happy automation with UiPath

1 Like

@anand_kumar4

please try this regex ([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)

Also you have find matches activity where you can use it or use directly with regexexpressions

cheers

1 Like

To extract email addresses from a text in UiPath:

  1. Assign Activity:

    inputText = "your input is arun@gmail.com, and the following email like rams@gmail.com and explain shaym@gmail.com"
    
  2. Matches Activity:

    • Input: inputText
    • Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
    • Output: emailMatches (IEnumerable)
  3. For Each Activity (to loop through emailMatches):

    • TypeArgument: System.Text.RegularExpressions.Match
    • Inside the loop: Use item.Value to access each email.

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