I have the regex ^[A-Za-z]{2}[A-Za-z0-9]{9}$ to validate the format of a string AB987654321
if (!( $address -match "^[A-Za-z]{2}[A-Za-z0-9]{9}$"))
{
write-host $address
}
I would like to modify this regex so that I would be able to validate smtp:[email protected]
So the string should start with smtp: or SMTP:
Then the above format '^[A-Za-z]{2}[A-Za-z0-9]{9}$'
anything after @
Could someone please help?
^smtp:[a-z]{2}[a-z0-9]{9}@.+if you don't care about the domain part.-matchis case insensitive, so you don't need[a-zA-Z]