I think for non-DNS experts (like me) it's important to know that in DNS terminology, the notation "tld." is used to donate top-level domains. (Note the trailing period)
So ".localhost." means "every domain within the 'localhost' tld", not "every domain that contains the string 'localhost'".
So ".localhost." means "every domain within the 'localhost' tld", not "every domain that contains the string 'localhost'".