Forum Discussion
Exchange Online patterns - what is the latest?
Nope, when I finally the pattern it fails with:
Error: Invalid Operation:
Cannot process argument transformation on parameter 'SubjectOrBodyMatchesPatterns'.
Cannot convert value "System.String[]" to type "Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]". Error: "You cannot configure a pattern with empty 'OR' conditions (e.g. 'a|' or '|a'). Remove the empty 'OR' conditions from the pattern to continue."
I try \w\w\w(\w|\w\w|\w\w\w|\w\w\w\w|\w\w\w\w\w) which failed at the first attempt, but appears to be acceptable. It is of course far too long, and enough of those patterns will either put the rule length over the maximum or burn through the maximum number of regular expression characters permitted for the whole tenant.
Incidentally, if one does provide an invalid pattern then the following error is given:
Error: Invalid Operation:
Cannot process argument transformation on parameter 'SubjectOrBodyMatchesPatterns'.
Cannot convert value "System.String[]" to type "Microsoft.Exchange.MessagingPolicies.Rules.Tasks.Pattern[]". Error: "The pattern contains incorrect characters, operators, or constructs. Learn what patterns are supported using https://go.microsoft.com/fwlink/?linkid=2092813"
Which links to:
https://learn.microsoft.com/en-gb/dotnet/standard/base-types/regular-expression-language-quick-reference and perpetuates the same ignorance we started with!