@mermonrroy I am on 18.4.3 so I can’t use open your file. It needs 18.4.4 or above for those activity packs. I will do my best to provide some regex statements based on your comments here.
I am using the following as my input text:
FW: Cambio de status en ODT: GT-IM-18839 - DUCA:251-9538546
Regex to pull out the ODT:
Assumptions: ODT is followed by a colon and a space
: and you want all characters until the next whitespace
Regex to pull out the DUCA:
Assumptions: DUCA is followed by a colon
: and no space. You want all characters until the next whitespace.
To pull the status, if it will always contain the entire status on one line and you want to grab the entire line I would recommend using String.Split by Environment.Newline and then using a for each statement to see if the line contains the word “Status:”. If it does, then the entire line of text is your status.
If you really want to pull the status using regex that is certainly possible though. Simply do the following
Status: i5 Solicitando ATC
Assumptions: You want to pull the entire line of text starting with the string
Status:. There is only one line with the word status, or you only want to pull the first one.
I would structure the workflow like this:
- Get all messages.
- For each message
2a. Read subject line and save as string variable (i’ll call subject)
2b. (in an if activity) Regex.IsMatch(subject,"\bODT: \S+\b"
2c (on true side of 2b’s if activity) Assign ODC (a string variable) = Regex.Match(subject, “\bODT: \S+\b”)
2d. (on false side of 2b’s if activity) Assign ODC = String.Empty
2e. (in an if activity) Regex.IsMatch(subject,“DUCA:\S+\b”)
2f. (on true side of 2e’s if activity) Assign DUCA (a string variable) = Regex.Match(subject, “DUCA:\S+\b”)
2g. (on false side of 2e’s if activity) Assign DUCA = String.Empty
2f. (in an if activity) String.IsNullOrEmpty(ODC) AndAlso String.IsNullOrEmpty(DUCA)
2g (on true side of 2f’s if activity) send email to support that both ODC and DUCA is empty
2h (on false side of 2f’s if activity) Assign Status (a string variable) = Regex.Match(YourEmailBodyAsStringVariable,“Status:.+”)
2i (still on false side of 2f’s if activity) do any other activities related to this email within here