EIN Regex for DLP

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!




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