Description
Hello @soulemike
The current regex in test Test-MtCisaDmarcRecordExist.ps1
$matchDomain = "(?:^|\.)(?'second'\w+.\w+$)"
has incorrect matches if the domain name has a dash (-) and a three-letter tld in it. For example, for domain 'test-domain.com' it matches and capture group 'second' is '.com', which obviously leads to errors in dmarc check.
If I understand this correctly it tries to get the top-level domain if a second-level domain is provided: test.domain.com -> domain.com.
Given there is an abundance of tlds available it is almost impossible to have a correct regex for all scenarios -> https://stackoverflow.com/a/21173813
Wouldn't it be better just to remove the regex and test dmarc records as is? In my example the two second-level domains are [tenantname].onmicrosoft.com and [tenantname].mail.onmicrosoft.com which both end up as skipped with dmarc check without regex.
Environment
Maester-Version: 1.1.2
PS-Version: 7.5.1
Kind regards
Christian