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

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