Forum Discussion
Examples of "subject matches patterns" regular expression when auto-applying sensitivity label
Hello,
I'm trying to auto-apply a sensitivity label to Exchange content (a specific user mailbox) where the rule is defined by a "subject matches patterns" condition. Microsoft requires a regular expression here. The emails I'm trying to apply the label to all have the words "Litigation Hold" in the subject line. I've tried to capture these using the following regular expressions but none have worked: (?:Litigation Hold), \bLitigation Hold\b, \sLitigation Hold\s, ^(?:Litigation Hold)$, Litigation Hold. What syntax is Microsoft looking for here? Any help or examples would be appreciated, thank you.
I'm sorry it took so long for you to get a response here but I believe, after some testing, that this is the regex you'd want to use, which will establish the word boundary as you were already trying to do, but you still need to use the "?:" to set the non-capture sub-pattern.
\b(?:Litigation Hold)\b
If you go to regex101: build, test, and debug regex and choose .NET (C#) as the flavor and get a match, then it will match within Microsoft.
- miller34mikeMicrosoft
I'm sorry it took so long for you to get a response here but I believe, after some testing, that this is the regex you'd want to use, which will establish the word boundary as you were already trying to do, but you still need to use the "?:" to set the non-capture sub-pattern.
\b(?:Litigation Hold)\b
If you go to regex101: build, test, and debug regex and choose .NET (C#) as the flavor and get a match, then it will match within Microsoft.
- tgraham-legalopsBrass Contributor
miller34mike Thank you! Have you had any luck using the "Header matches patterns" condition? No matter what I try, I can't get that one to work. Any tips would be greatly appreciated.
- miller34mikeMicrosoft
Unfortunately, I have not used or tested that condition in the past. If you'd like to send me a specific example through a direct message on here I'll happily circulate it with others to see if we can find the resolution.
- tgraham-legalopsBrass Contributor
I finally got Header Matches Patterns to work. It needs to be something like X-MS-TrafficTypeDiagnostic: EdiscoveryHoldNotification.