"Tag matches" field in advanced tag change search seems to search as a substring instead of exact match.
Example here: https://danbooru.donmai.us/post_versions?commit=Search&search%5Btag_matches%5D=tro&search%5Bupdater_name%5D=worldendDominator
I was searching for my edits on tro's posts, but I got everything with "tro" in any tag, like alice_margatroid.
While this might be intended, "use * for wildcard" seems to imply it's otherwise exact.
It's searching on a tag string and not individual tags, so getting an exact match isn't exactly straightforward.
Tag matches
The tag_matches parameter is the simple version, and it it assists the user in the search by wrapping the first word found in the query with wildcards and then doing a tags_ilike search. This normally works okay for most tags, however as you noted if the tag you are searching on is a substring of other tags, then there is going to be false positives.
Tags ilike
A more advanced version is to use the tags_ilike parameter directly, and wrap the tag with spaces first and then wildcards, e.g. * tro *
.
Example: https://danbooru.donmai.us/post_versions?search%5Btags_ilike%5D=%2A+tro+%2A&search%5Bupdater_name%5D=worldendDominator
This will find most tags, however there will be misses if the tag occurs at the beginning or end of the tag string. If this is unlikely, then this would be the preferable and fastest method.
Tags regex
This tags_regex parameter is the most complex version to use, but it will also be the most precise. To find a tag using this method, the tag has to be regex escaped and then wrapped with a (^| )
in the beginning and a ($| )
at the end, e.g. (^| )tro($| )
.
Example: https://danbooru.donmai.us/post_versions?search%5Btags_regex%5D=(%5E%7C%20)tro(%24%7C%20)&search%5Bupdater_name%5D=worldendDominator
However, as this uses a more complex method of matching, it will be slower than any of the other searches, and so it will also more likely timeout.
Other
See Help:Text Syntax for all of the other variations of parameters that can be used on the tags field.