Fetch url from outlook e mail body

can anyone help me scrape url from e mail body which is mark as blue.

Hi @Aleem_Khan,

Please try this expression: (?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])

I have also attached the expression into a text file and shared it.

Expression.txt (159 Bytes)

Hope this helps you out.


1 Like

Hi @Aleem_Khan

There are two methods to extract Url from Email

1 ) Matches activity
In the matches activity click configure regular expressions and Choose regex dropdown as Url

pass input string as email body variable and create a output variable in result tab
Finally output variable holds Url value

2)using regex in assign activity

you have to create a variable Like *Str_Out

Str_Out=System.Text.RegularExpressions.Regex.Match(your_email_body_string_variable, “(?:(?:https?|ftp|file)://|www.|ftp.)(?:([-a-zA-Z0-9+&@#/%=~|$?!:,.]*)|[-a-zA-Z0-9+&@#/%=~|$?!:,.])(?:([-a-zA-Z0-9+&@#/%=~_|$?!:,.])|[a-zA-Z0-9+&@#/%=~_|$])”).Value

Finally Str_Out holds the url value

Robin S

1 Like

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