We can search with tags as we all know like [TagA]
. But sometimes I know that even though a question has TagA
it will belong to a different context if it also has TagB
.
Is there a way I can search for posts having one tag but not the other?
Yes, just put a minus in front of any tags (or other search criteria) that you want to exclude. From the How do I search page:
To exclude results from a tag, term or phrase, prefix it with
-
in your query:waffles -unicorns
finds posts that mention tasty batter-based breakfasts without including mythical creatures, while[laurel] -[hardy]
includes only posts pertaining to the first half of the classic comedy couple.
As you can see this works for tags, so your search would be something like [TagA] -[TagB]
. There were problems in the past with tag only searches messing up the excluded tags, but I think they are resolved now.