Sign up ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

Is there a way to search/filter gmail emails by the absolute domain without subdomains? If just do a search/filter on it includes all subdomains like,, etc.

I know I can manually exclude all of those with -{}, but the list of subdomains is quite long (and I don't really know the full list).

share|improve this question

migrated from Feb 23 '13 at 22:39

This question came from our site for computer enthusiasts and power users.

Did you try from:"" ? – BrianAdkins Feb 23 '13 at 19:57
Yes, from:"" unfortunately works the same as It really seems like gmail is ignoring the @ sign. – studgeek Feb 24 '13 at 16:10

1 Answer 1

What you can use is a Google Script that does regex match with the TO field to find emails with an exact domain in the address:

function myFunction() {

  var label = GmailApp.getUserLabelByName("");
  if (!label) label = GmailApp.createLabel("");

  var threads ="");
  for (var t in threads) {
    var msg = threads[t].getMessages()[0];
    if (msg.getTo().match(/\@google\.com/)) {


Also see: Advanced Gmail Search with RegEx

share|improve this answer
I like the idea, and it eliminated, but for some reason I still see I've looked at the original message and it sures looks to me like your trick should work. The From line is From: "Google+" <> – studgeek Feb 24 '13 at 16:07
PS, Thanks for your blog. It's helped me out in the past :). – studgeek Feb 24 '13 at 16:07
Actually, it doesn't seem to be working me at all now. It seems like the search engine ignores the periods. – studgeek Mar 1 '13 at 16:49
Unfortunately, I does not work. I've started a bounty, hoping for answers... – Krzysztof Wolny Aug 6 at 15:44
See my updated answer. – Amit Agarwal Aug 6 at 19:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.