UI Path email contains values from to

Hello everyone,

my goal is to move all unread email with a specific subject to folder. i already got it working for a String like “request”. But what i need is to move those email which subject contains a specific range of numbers.

For example: all emails which subject contains a number from 0 - 100 move to this folder.

i got
if mail.Subject.Contains(“request”)
then move to folder “…”

how to set it up for a range of numbers?

Sry for my bad english.

Greetings

Hi, welcome to the community!
If this number that appear in the subject comes in an specific text like: “My email number 1”, “My email number 200”, then we could use regular expression to first extract the number from the subject as integer type variable. After that you can use an IF condition like:
IF varNumber <= 100

1 Like

Thanks bcorrea,
you are right, the subject will always be a mix of strings and ints.

how do i extract the number from the subject?

If you give us an example subject, we can help build this.

the goal is to sort out inquiry emails and move them to the fitting “inquiry folder”. The subject will always be something like “inquiry 2345”.

so i basicly want to say:
if mail.Subject.Contains “number from 0 - 1000” move to folder “inquiry 1000”
if mail.Subject.Contains “number from 1001 - 2000” move to folder “inquiry 2000”

  1. Create variable to hold the number as Integer
  2. Assign varNumber = Cint(Regex.Match("mail.Subject", "\d+").Value)
  3. IF varNumber <= 1000
  4. ELSE

Note that this will work if all emails have a number in the subject, if not the case, then you need to check that regex.match before continuing…

use like this then: System.Text.RegularExpressions.Regex.Match(...

so like?
System.Text.RegularExpressions.Regex.Match(“mail.Subject”, “\d+”).Value)

compiler: missing declaration end

System.Text.RegularExpressions.Regex.Match((“mail.Subject”, “\d+”).Value)

is not working either.

like this
varNumber = Cint(System.Text.RegularExpressions.Regex.Match(mail.Subject, "\d+").Value)