Using Multiple "Is Match" Activities To Find Pattern in List of Emails

Hello,

I’m trying to iterate through emails in Outlook, and send a message if the body of any of those emails contains a specific RegEx pattern. I have already verified that the RegEx is working and accurate. I’ve also verified that it is iterating through the correct emails.

However - when I run my automation it is not working as expected. I removed the two emails that match each RegEx pattern, and it is still returning my “Then” statement. When it should be returning my “Else” statement. Do I need to adjust my workflow at all since I’m using two “Is Match” activities?

Here is my workflow:


image

Here is my first “Is Match” activity:

image

Here is my second “Is Match” activity:

image

Thanks!

Refer this. Hope it helps!

1 Like

Thanks, I think my RegEx is fine though, I used the UiPath Regex Builder to create it and when I test a string it correctly finds the match.

All I want to do is:

If it does find a match in any of the email body’s, then send a specific message. Else send a different message.

Here are my variables:

I’ve also tried adjusting my workflow, but it’s still not working properly.

Write the email body content that has the match into text file. Now in an online regex tester put the text and the pattern to check the existence of the Match. If its not working, then you need to update the regex. It might be matter of space or any special characters.

1 Like

So I went ahead and did this - and it seems to still be matching the pattern correctly:

@Luecke_Anthony Refering to your screenshot and with the interpretation the bot should only mail 1 email for all tests the ensure you will stop the iteration e.g. with a break. Otherwise for each email check a mail will be sent

About catching the issue do set a breakpoint and do inspection / analysis within the watch panel with live values. Also you can edit variable values and test the if / else routes

1 Like

Keep debugger and execute the ismatch activity. Check what is the value of the flag. Also check is there a variable created twice with same name.

1 Like