Reputation: 107
For some reason, regex doesn't return a value. So, when I do a write-host $d[3], it doesn't return anything. But when I put the same regex in its own switch (without the domain, smtp, 5digit), it works fine. Why is that?
Function _getCountrySettings #Add additional countries to the switch statement
{
param($CountryID)
switch ($CountryID)
{
#"XX" {$d = ('user AD domain','*@ smtp domain','number of digits in the extension')}
"ES" {$d = ('eurs.abc.net','*@es.abc.com','5digit','^(\+[3][4])?([1-9]\d\d{7})$')} #Spain
"CZ" {$d = ('eure.abc.net','*@cz.abc.com','5digit','^(\+[4][2][0])?([1-9]\d\d{7})$')} #Czech Republic
"UK" {$d = ('uk.eurw.abc.net','*@uk.abc.com','5digit')} #UK
"IE" {$d = ('eurw.abc.net','*@ie.abc.com','5digit')} #Ireland
Default {write-host "[ERROR] Country Code not found"; exit}
}
return $d
}
Upvotes: 1
Views: 87
Reputation: 107
I just found
"ES" {$d = ('eurs.abc.net','*@es.abc.com','5digit')
at the bottom of the switch. That's why ES wasn't returning the regex.
Upvotes: 1