SOLVED

Office 365 DLP Regular Expression (RegEx)

Steel Contributor

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

 

1234 1234 1234 1234

2 Replies
best response confirmed by Marvin Oco (Steel 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"

Thanks Vasil
1 best response

Accepted Solutions
best response confirmed by Marvin Oco (Steel 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"

View solution in original post