Test, validate and match regular expressions
Matches a formatted US Social Security Number (XXX-XX-XXXX) using a consistent separator (space, hyphen, en/em dash, or slash), built for Microsoft Purview DLP policies. It enforces SSA validity rules by rejecting area numbers 000, 666, and 900-999, group 00, serial 0000, repeated-digit SSNs like 111-11-1111, and known invalid/test SSNs such as 078-05-1120 and 123-45-6789. Lookarounds prevent matches embedded in longer digit strings or adjacent digits/dashes, and a trailing check excludes common file extensions (e.g., .pdf, .docx, .jpg) to reduce false positives from filenames.