maddy99
(mani)
May 5, 2021, 6:01am
1
Hi All,
I have taken get exchange mail activity, removing unwanted text from body, want to extract a URL from mail body. Can anyone help me to extract only URL from mail body using regex.
I will be reading mail one by one.
I want to assign these regex to some string variable.
can someone please help…
Please find the sample mail:
The following store has been approved Location No : 21872 India : Mumbai AIf @ MAST Market No : 464738 https://pdportal.8-ten.com/Main/ProjectMain.aspx?projectLocationId=427409
Adrian_Star
(Adrian Starukiewicz)
May 5, 2021, 6:09am
2
Hi,
try this:
output = System.Text.RegularExpressions.Regex.Match(your_String,"(?=http).+").Value
Preview link: regex101: build, test, and debug regex
2 Likes
maddy99
(mani)
May 5, 2021, 7:05am
3
Hi @Adrian_Star ,
It works… Thank You for the help…
And my one more doubt is…if there is an extra text after end of URL.
If I want to stop at end of URL “427409”. How can I change the regex…
Please Help.
Adrian_Star
(Adrian Starukiewicz)
May 5, 2021, 7:21am
4
Something like this:
output = System.Text.RegularExpressions.Regex.Match(your_String,"(?=http)\S+").Value
Preview link: regex101: build, test, and debug regex
1 Like
system
(system)
Closed
May 13, 2021, 5:43pm
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.