SOLVED

Office 365 DLP Regular Expression (RegEx)

%3CLINGO-SUB%20id%3D%22lingo-sub-879636%22%20slang%3D%22en-US%22%3ERe%3A%20O365%20DLP%20regex%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-879636%22%20slang%3D%22en-US%22%3E%3CP%3EThere%20are%20probably%20dozen%20different%20ways%20to%20match%20this%20string%2C%20you%20can%20try%20something%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%22%5Cd%7B4%7D%5Cs%5Cd%7B4%7D%5Cs%5Cd%7B4%7D%5Cs%5Cd%7B4%7D%22%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EIf%20you%20want%20to%20avoid%20leading%2Ftrailing%20numbers%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%22%5Cb%5Cd%7B4%7D%5Cs%5Cd%7B4%7D%5Cs%5Cd%7B4%7D%5Cs%5Cd%7B4%7D%5Cb%22%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3EIf%20you%20want%20to%20match%20the%20actual%20numbers%201..4%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20style%3D%22background-color%3A%20%23ffffff%3B%22%3E%22%5Cb%5B1-4%5D%7B4%7D%5Cs%5B1-4%5D%7B4%7D%5Cs%5B1-4%5D%7B4%7D%5Cs%5B1-4%5D%7B4%7D%5Cb%22%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-880356%22%20slang%3D%22en-US%22%3ERe%3A%20O365%20DLP%20regex%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-880356%22%20slang%3D%22en-US%22%3EThanks%20Vasil%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-878750%22%20slang%3D%22en-US%22%3EOffice%20365%20DLP%20Regular%20Expression%20(RegEx)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-878750%22%20slang%3D%22en-US%22%3E%3CP%3EWhat%20is%20the%20O365%20DLP%20regex%20for%20digit%20string%20below%20(including%20spaces)%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E1234%201234%201234%201234%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-878750%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Super Contributor

What is the O365 DLP regex for digit string below (including spaces)?

 

1234 1234 1234 1234

2 Replies
Highlighted
Best Response confirmed by Marvin Oco (Super Contributor)
Solution

There are probably dozen different ways to match this string, you can try something like this:

 

"\d{4}\s\d{4}\s\d{4}\s\d{4}"

 

If you want to avoid leading/trailing numbers:

 

"\b\d{4}\s\d{4}\s\d{4}\s\d{4}\b"

 

If you want to match the actual numbers 1..4:

 

"\b[1-4]{4}\s[1-4]{4}\s[1-4]{4}\s[1-4]{4}\b"

Highlighted
Thanks Vasil