/target will target the first thing that matches what you put after it, but
/targetexact will only target
exactly what you put after it.
For example, let's say you are surrounded by 10 neutral npcs named "Billy" and a boss named "Billiam".
/target Bill will target any of these 11 npcs with no guarantee who, but
/targetexact Bill will do nothing because there is no npc named Bill nearby.
If you are familiar with Lua, here's the two functions that these commands call:
Lua Code:
SecureCmdList["TARGET"] = function(msg)
local action, target = SecureCmdOptionParse(msg);
if ( action ) then
if ( not target or target == "target" ) then
target = action;
end
TargetUnit(target);
end
end
SecureCmdList["TARGET_EXACT"] = function(msg)
local action, target = SecureCmdOptionParse(msg);
if ( action ) then
if ( not target or target == "target" ) then
target = action;
end
TargetUnit(target, true);
end
end
And the function they use:
https://wow.gamepedia.com/API_TargetUnit
(TargetUnit is defined in the C portion of WoW, not reasonably available to the public)