Download attachements in outlook if subject contains a (10 digigt) number



New user of of UIPath. Trying to figure out how to download attachements from outlook mails, when a 10 digit number appears in the subject line (syntax **-).

My problem is, i don’t know how to define the 10 digit number under “condition”. Any suggestions?

Best regards,


Is subject line is static?


For the most part, the subject line is static, but there are exceptions.



And for some part of the subject lines, the 10 digit number does not have the hyphen between the 6th and the 7th digit.



Could you could use Regex to determine the match in the subject header

if regex.IsMatch(mail.subject.ToString)

where regex is something along the lines of “\d{6}(|$| |-)\d{4}” - 6 number followed by either 4 numbers, space 4 numbers or dash four numbers


Thanks for the reply. I think i now understand the regex part, but i’m not sure where in the sequence to put it?


create a variable of type system.text.regularexpressions.regex and set the default to New Regex ("\d{6}(|$| |-)\d{4}". You can then use it in your decision as

if myRegex.IsMatch(mail.subject.ToString)