Robot reading rexex from email body works on dev and acceptance but not on prod

We have a robot that reads some data out of the body of an email with the integration service outlook 365 connector from an shared mailbox
This works fine on dev tenant/machine and nonprod tenant/machine but on production some regex expressions are failing.
So same nuget package on all environments. but on prod with different account
When debugging on on prod i see regex is failing, when i then copy the body of the mail from prod debug session to development debug session the same regex is working fine

Hi @marloo

The issue could be caused by several factors. First, the email body may contain hidden characters like non-breaking spaces or zero-width spaces. Second, the email body might be in HTML format, which can affect how the regex functions. Third, line endings may differ between environments, such as \r\n versus \n. Fourth, the Outlook 365 Integration Service might handle the email differently in each environment. Lastly, encoding differences between the environments could lead to issues.

Assign the normalized email body:

CleanBody = System.Text.RegularExpressions.Regex.Replace(EmailBody, "\s+", " ").Trim()
CleanBody = System.Text.RegularExpressions.Regex.Replace(CleanBody, "[^\u0000-\u007F]+", "")
CleanBody = CleanBody.Replace("\r\n", "\n")

Apply your regex pattern:

Match = System.Text.RegularExpressions.Regex.Match(CleanBody, "your_regex_pattern_here")

Happy Automation

@marloo,

Check if the deployed bot is using the correct version of the package dependencies. You can check it from user profile → .Nuget folder.

@marloo

Can you share a sample regex and a sample body which is failing may be we can make it ignore the extra characters which might be occuring

Cheers

Thanks Prashant

The solution to clean the body is working on all out environments/machines
We are adding this to our general object repository
So problem is solved