Something like this?
though that rejects "...@bar.foo.example.com" as well. This might be a good thing or a bad thing or a don't-care thing, you didn't specify./@(?!bar\.).*\.example\.com$/
So you could instead go for:
/@(?!bar\.example\.com$).*\.example\.com$/
If your teacher will let you declare a variable, then you could even use:
ormy $ex= ".example.com"; # ... if( /@(?!bar\Q$ex\E$)\Q$ex\E$/ ) {
But all of these don't reject "...@foo.bar.example.com" which you might want to do, so you could go for:my $ex= quotemeta(".example.com"); # ... if( /@(?!bar$ex$)$ex$/ ) {
/@(.*\.)?(?!bar\.)[^.]+\.example\.com$/
Updated based on shenme's reply. - tye/@((.*\.)?(?!bar\.)[^.]+\.)?example\.com$/
In reply to Re: Match all emails from all subdomains for a domain except one.. (tye)
by tye
in thread Match all emails from all subdomains for a domain except one..
by ehdonhon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |