I am trying to write a regex that works in Google Apps that matches email addresses on incoming messages with subdomains, e.g.:
root@*wildcard*.mydomain.com
but not
root@mydomain.com
So that I can use Gmail to redirect them to the proper recipient @mydomain.com.
The following regex works in my regex editor but doesn’t match anything in Gmail testing:
^[-+.0-9A-Z_a-z]+@[-+.0-9A-Z_a-z]+\.(mydomain.com)$
For those of you familiar with GApps, I’m referring to the setting under Settings > Email > Receiving routing > Configure > Options.
Any help would be appreciated. Thank you!
Try putting the dash last; some regex dialects can’t handle a leading dash in a character class. Other than that, your regex looks OK.