Forum Discussion
Marvin Oco
Sep 27, 2019Iron Contributor
Office 365 DLP Regular Expression (RegEx)
What is the O365 DLP regex for digit string below (including spaces)?
1234 1234 1234 1234
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"
2 Replies
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"
- Marvin OcoIron ContributorThanks Vasil