EIN Regex for DLP

%3CLINGO-SUB%20id%3D%22lingo-sub-2606207%22%20slang%3D%22en-US%22%3EEIN%20Regex%20for%20DLP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2606207%22%20slang%3D%22en-US%22%3E%3CP%3EWe%20are%20trying%20to%20create%20a%20new%20policy%20to%20detect%20Employer%20Identification%20Number%20(EIN).%20I'm%20very%20new%20to%20Regex%20so%20I%20need%20some%20help.%20We've%20tried%20the%20below%20regex%20and%20MCAS%20is%20showing%20me%20an%20error%20of%3A%26nbsp%3B%3CSPAN%20class%3D%22ng-scope%22%3E%3CSPAN%20class%3D%22ng-binding%22%3ECapturing%20parenthesis%20not%20allowed%20in%20regular%20expression.%20Does%20anyone%20know%20how%20to%20convert%20the%20below%20regex%20to%20something%20without%20the%20capturing%20parentheses%3F%20Thanks!%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E(%5B07%5D%5B1-7%5D%7C1%5B0-6%5D%7C2%5B0-7%5D%7C%5B35%5D%5B0-9%5D%7C%5B468%5D%5B0-8%5D%7C9%5B0-589%5D)-%3F%5Cd%7B7%7D%3C%2FDIV%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2606207%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECloud%20App%20Security%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EData%20Protection%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2684337%22%20slang%3D%22en-US%22%3ERe%3A%20EIN%20Regex%20for%20DLP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2684337%22%20slang%3D%22en-US%22%3EYou%20may%20have%20solved%20this%20already%2C%20but%20MCAS%20doesn't%20allow%20the%20usage%20of%20capture%20groups.%20You%20can%20use%20a%20non-capture%20group%20instead.%20After%20the%20open%20parenthesis%20insert%20%22%3F%3A%22%20to%20make%20the%20group%20non-capturing.%20End%20result%3A%20(%3F%3A%5B07%5D%5B1-7%5D%7C1%5B0-6%5D%7C2%5B0-7%5D%7C%5B35%5D%5B0-9%5D%7C%5B468%5D%5B0-8%5D%7C9%5B0-589%5D)-%3F%5Cd%7B7%7D%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2816429%22%20slang%3D%22en-US%22%3ERe%3A%20EIN%20Regex%20for%20DLP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2816429%22%20slang%3D%22en-US%22%3EOne%20way%20to%20do%20this%20would%20be%20to%20create%20a%20custom%20Sensitive%20Information%20type%20in%20O365%20Compliance%20Center%2C%20add%20the%20new%20SIT%20to%20a%20Sensitivity%20Label%20and%20then%20in%20MCAS%20create%20a%20policy%20that%20watches%20for%20this%20Sensitivity%20Label%3C%2FLINGO-BODY%3E
New Contributor

We are trying to create a new policy to detect Employer Identification Number (EIN). I'm very new to Regex so I need some help. We've tried the below regex and MCAS is showing me an error of: Capturing parenthesis not allowed in regular expression. Does anyone know how to convert the below regex to something without the capturing parentheses? Thanks!

 

([07][1-7]|1[0-6]|2[0-7]|[35][0-9]|[468][0-8]|9[0-589])-?\d{7}

 

2 Replies
You may have solved this already, but MCAS doesn't allow the usage of capture groups. You can use a non-capture group instead. After the open parenthesis insert "?:" to make the group non-capturing. End result: (?:[07][1-7]|1[0-6]|2[0-7]|[35][0-9]|[468][0-8]|9[0-589])-?\d{7}
One way to do this would be to create a custom Sensitive Information type in O365 Compliance Center, add the new SIT to a Sensitivity Label and then in MCAS create a policy that watches for this Sensitivity Label