How to use regex capturing-group in custom sensitive information in DLP Office365?

%3CLINGO-SUB%20id%3D%22lingo-sub-266618%22%20slang%3D%22en-US%22%3EHow%20to%20use%20regex%20capturing-group%20in%20custom%20sensitive%20information%20in%20DLP%20Office365%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-266618%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20triyng%20to%20create%20a%20custom%20sensitive%20information%20type%20in%20Office365%20(Security%20%26amp%3B%20Compliance%20Center)%20to%20match%20possible%20passwords%20(at%20least%208%20digits%2C%20a%20letter%2C%20a%20number%20and%20a%20special%20character).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegex%20(it%20works%20-%20e.g.%20%3CA%20href%3D%22https%3A%2F%2Fregex101.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noreferrer%20noopener%22%3Ehttps%3A%2F%2Fregex101.com%2F%3C%2FA%3E)%3C%2FP%3E%3CP%3E%3CSTRONG%3E(%3F%3D.*%5BA-Za-z%5D)(%3F%3D.*%5Cd)(%3F%3D.*%5B%22!%40%23%24%25%C2%A8%26amp%3B%3CEM%3E()-_%2B%5D)%5BA-Za-z%5Cd%22!%40%23%24%25%C2%A8%26amp%3B%3C%2FEM%3E()-_%2B%5D%7B8%2C%7D%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBut%20when%20I%20try%20to%20set%20this%20code%20in%20Office365%20I%20receive%20the%20error%20message%20below%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CBLOCKQUOTE%3E%3CP%3E%3CEM%3EYou%20cannot%20configure%20a%20pattern%20with%20groups%20or%20multiple%20match%20conditions%20like%20(.*%2C.%2B%2C.%7B0%2Cn%7D%20or%20.%7B1%2Cn%7D.%20Remove%20the%20group%20or%20the%20multiple%20match%20condition%20from%20the%20pattern%20to%20continue.%3C%2FEM%3E%3C%2FP%3E%3C%2FBLOCKQUOTE%3E%3CP%3EIs%20there%20a%20way%20to%20circunvent%20this%20situation%3F%20Is%20it%20possible%20to%20reach%20the%20same%20result%20in%20another%20way%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%20class%3D%22container%20%20%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-781207%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20use%20regex%20capturing-group%20in%20custom%20sensitive%20information%20in%20DLP%20Office365%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-781207%22%20slang%3D%22en-US%22%3ELooks%20like%20you%20encountered%20typical%20issue.%20If%20I%20remember%20correctly%20O365%20uses%20Boost.Regex%20engine%2C%20regex101%20doesn't%20have%20it%20(PCRE%2C%20ECMAScript%2C%20Python%2C%20GoLang)%2C%20so%20your%20validation%20helps%20to%20find%20only%20issues%20which%20are%20in%20common%20for%20both.%3CBR%20%2F%3E%3CBR%20%2F%3EAt%20first%20sight%3A%208-infinite%20matches%2C%20positive%20lokahead%2Cs%2C%20%22anything%20between%200%20and%20inifnite%20occurences%22%20(aka%20%22I%20have%20no%20idea%20what's%20there%2C%20but%20would%20like%20to%20match%20it%22)%20-%20which%20are%20not%20supported%20by%20Office's%20regex%20engine.%20Apart%20of%20that%2C%20they%20are%20also%20very%20dangerous%20and%20it's%20better%20to%20avoid%20them%20(despite%20that%20they%20are%20very%20convenient%20in%20many%20cirumstances).%3CBR%20%2F%3E%3CBR%20%2F%3EHere%20is%20some%20more%20information%20from%20MS%3A%3CBR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2Fsecuritycompliance%2Fcreate-a-custom-sensitive-information-type-in-scc-powershell%23potential-validation-issues-to-be-aware-of%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Foffice365%2Fsecuritycompliance%2Fcreate-a-custom-sensitive-information-type-in-scc-powershell%23potential-validation-issues-to-be-aware-of%3C%2FA%3E%3CBR%20%2F%3E%3CBR%20%2F%3EBtw%2C%20your%20regex%20for%20passwords%20-%20it%20won't%20work%20as%20you%20might%20think.%20Counter-examples%20for%20your%20regex%20(they%20will%20be%20matched%2C%20but%20cannot%20be%20a%20password%20if%20you%20set%20strong%20password%20configuration)%3A%3CBR%20%2F%3E000aaa0000%3CBR%20%2F%3E10.10.10.10%3CBR%20%2F%3Emydomain.com%3CBR%20%2F%3Ehellooo!%3C%2FLINGO-BODY%3E
Occasional Visitor

I'm triyng to create a custom sensitive information type in Office365 (Security & Compliance Center) to match possible passwords (at least 8 digits, a letter, a number and a special character).

 

Regex (it works - e.g. https://regex101.com/)

(?=.*[A-Za-z])(?=.*\d)(?=.*["!@#$%¨&()-_+])[A-Za-z\d"!@#$%¨&()-_+]{8,}

 

But when I try to set this code in Office365 I receive the error message below:

 

You cannot configure a pattern with groups or multiple match conditions like (.*,.+,.{0,n} or .{1,n}. Remove the group or the multiple match condition from the pattern to continue.

Is there a way to circunvent this situation? Is it possible to reach the same result in another way?

 

 
1 Reply
Looks like you encountered typical issue. If I remember correctly O365 uses Boost.Regex engine, regex101 doesn't have it (PCRE, ECMAScript, Python, GoLang), so your validation helps to find only issues which are in common for both.

At first sight: 8-infinite matches, positive lokahead,s, "anything between 0 and inifnite occurences" (aka "I have no idea what's there, but would like to match it") - which are not supported by Office's regex engine. Apart of that, they are also very dangerous and it's better to avoid them (despite that they are very convenient in many cirumstances).

Here is some more information from MS:
https://docs.microsoft.com/en-us/office365/securitycompliance/create-a-custom-sensitive-information-...

Btw, your regex for passwords - it won't work as you might think. Counter-examples for your regex (they will be matched, but cannot be a password if you set strong password configuration):
000aaa0000
10.10.10.10
mydomain.com
hellooo!