Without seeing exactly what it isn't working with I'm just taking a stab in the dark.
My best guess is it's putting some form of punctuation after the person's name.
If you aren't concerned about it potentially matching something that isn't a name, you can just remove both %f[] patterns from the string and it would match anything that looks like "Name-Realm", regardless of what's around it, otherwise you can try this, which should cover any punctuation.
Lua Code:
ChatFrame_AddMessageEventFilter('CHAT_MSG_TEXT_EMOTES', function(self, event, msg, ...)
return false, (msg:gsub('%f[^%z%s"]([^\1-\64\91-\96\123-191]+)%-%u%l%a+%f[%z%s".,!?\']', '%1')), ...
end)