I was doing some searching and found a similar topic Powershell find non-ASCII characters in text file
MY function below is not handling all cases for example apostrophe or all the special characters
function IsStringDiacritic {
param (
[parameter(Mandatory = $True)][string]$String
)
If ($String -as [System.Net.Mail.MailAddress]) {
$String = $String.Split('@')[0]
}
Return [bool]($String -cmatch '[^\x20-\x7F]')
}
Above is the function I made but I am not getting what I need.
I want to send the function first.last and if there is a diacritic return a true or false.
My function is able to deal with an email address as well with the test and then split but that is not the primary part.
I think I need a regex that will look at first.last or first last but I am not sure how to include the possiblites.
Any better ideas?