Microsoft Secure Tech Accelerator
Apr 03 2024, 07:00 AM - 11:00 AM (PDT)
Microsoft Tech Community
SOLVED

Examples of "subject matches patterns" regular expression when auto-applying sensitivity label

Copper Contributor

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.

3 Replies
best response confirmed by tgraham-legalops (Copper Contributor)
Solution

@tgraham-legalops 

 

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.

 

miller34mike_0-1694610844492.png

miller34mike_1-1694611129628.png

miller34mike_2-1694611169949.png

 

 

 

 

 

@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. 

@tgraham-legalops 

 

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.

1 best response

Accepted Solutions
best response confirmed by tgraham-legalops (Copper Contributor)
Solution

@tgraham-legalops 

 

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.

 

miller34mike_0-1694610844492.png

miller34mike_1-1694611129628.png

miller34mike_2-1694611169949.png

 

 

 

 

 

View solution in original post