Select the specific word to next word from subject of the outlook mail


My scenario like this,

1.Read the mail
2.Select the Specific mail
3.In there I get the specific word into a variable (Eg: accountNo 095 - In there i want to get next to accountNo(eg: 095))
4. Then I set the value to clipboard

Above I have trouble at 3rd one…Anyone give the support.


If the input you want is numbers - as in your example -, you can use Regex replace.

Select the Replace -activity and in the input put your variable that has ‘accountNo 095’ and in the pattern property type “[^0-9]”, this will replace everything that is not a number. Then in replacement property put “” , which is empty char.

Other methods would be to split the string at " ", so you would get 2 separate strings, accountNo in one and 095 in another.


This is my real scenario,

Pre Request:
I got more then one mail.Those mails subject format is same.But only Account No value is change.
Each mail have attachment like as pdf.
These pdf are secured by password.These password are stored in excel sheet.Password should be find by Account No.


  1. Read the mails and get the Account No
    2.Save the PDF
    3.Open the excel sheet
    4.Read the excel and find the password (Password should be find by Account No.)
    5.Read the PDF and Verify the Account No in the pdf

So In there I want to get account no value from the subject line.This is my question?


If you want to extract an ID from a string there’s a tutorial specifically about that:

Was that what you were looking for?


Still I am not get the point…
“The pdf file name is salary” In here How to filter and take “salary” word? (This is one subject line.another one “The pdf file name is empdetails”)
SO i want to get next to "is "…


There are many ways:

  1. you can split the string by space split(strSubject," ") and do for each string value , once you find your reference string “is” next index value will be ur answer.

  2. you can use REGEX


3)use substring

string tobesearched = “is”
string code = myString.Substring(myString.IndexOf(tobesearched) + tobesearched.Length);


Thanks a lot…:+1: