Get text file location from body

Hi,

I receive email with this type of “link” in body (an example):

file:\\sdf00568.aad.ddf\ihinčk\adf\adfadf\dvdv\56422664\6846422154\

and other text. How do I extract it so I can follow the “link”?

Hi Markosc,
I think Regex would be your friend here :slight_smile: Are you familiar with it?

In you case the Regex could be something like this (from regex101.com):

Or you could loop through the lines of the text one by one, and see which one starts with “file”. It depends on how the e-mail body is formatted, and if it will always be the same.

And here is the regex that will match UNC from received e-mail:

(\\\\([a-z|A-Z|0-9|-|_|\s]{2,15}){1}(\.[a-z|A-Z|0-9|-|_|\s]{1,64}){0,3}){1}(\\[^\\|\/|\:|\*|\?|"|\<|\>|\|]{1,64}){1,}(\\){0,}

Source: c# - Regex to validate a Windows UNC path - Stack Overflow

Cheers

1 Like

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