Get the substring from the .txt file

Hi All,

i would like to fetch the mail ID and the date from below text from .txt file.

Please reset my ID: ABC12@XYZ.COM date 10/15/2018.

Please help me on this. Thanks in advance.

Use regular expression with Matches activity to retrieve the values. That gives accurate results.

Is the format always the same? You can either use regex or substrings for this, I prefer regex. Works like this:

email = System.Text.RegularExpressions.Regex(inputText, "\S+@.+\.\S+").ToString
date = System.Text.RegularExpressions.Regex(inputText, "\d+/\d+/\d+").ToString

The regex patterns might need to be different, depending if the input data format changes or not.

1 Like

Thanks All

I will try and let you know