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


#1

Hi!

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,
Sofus


#2

Is subject line is static?


#3

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

/Sofus


#4

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

/Sofus


#5

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


#6

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


#7

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)