tto / docs / compliance / sensitive information portal

regex in the sensitive information portal within m365 compliance center are case sensitive!

when using a word match, the portal defaults to the following pattern:

(?:^|[\s,;\:\(\)\[\]"'])(put your word here)(?:$|[\s,\;\:\(\)\[\]"']|\.\s|\.$)

The start of the string must be

the end of the string must be

Matches are case-sensitive! Use (?i) for case-insensitive matches!

(?i)(?:^|[\s,;\:\(\)\[\]"'])(\d{4}-\d{2}-\d{2}\stest\string)(?:$|[\s,\;\:\(\)\[\]"']|\.\s|\.$)

test pattern with powershell

powershell matches are case-insensitive by default. Use (?-i) to remove the i modifier and make matches case-sensitive.

$pattern = @'
(?-i)(?:^|[\s,;\:\(\)\[\]"'])(\d{4}-\d{2}-\d{2}\stest\sstring)(?:$|[\s,\;\:\(\)\[\]"']|\.\s|\.$)
'@
$testStrings = @(
    '2021-06-15 test string',
    '123:2021-06-15 Test String:sdf',
    'bla bla 2022-06-15 test String asdsad'
    '2021-06-15 test string afdsfsd',
    '\12021-06-15 test string@3'
)
$testStrings -match $pattern