View Single Post
09-26-15, 12:26 PM   #16
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
Originally Posted by Gryns View Post
It works for some, but not for other. For instance, it filters the realm suffix from the /hi emote but it doesn't grab the /wave emote for instance. i.e "Semlar greets Gryns with a hearty hello" but, "Semlar waves at "Gryns-Aggramar" Any idea why that is?
It's not looking for names with quotes around them, the %f[] at the start and end of the pattern contains a character class representing a transition from any of the characters inside of the brackets to the characters in the name itself.

%s matches any whitespace and %z essentially matches "nothing", which allows it to match the name if it's at the start or end of the message.

So, since "Gryns-Aggramar" is surrounded by quotes and not spaces, the pattern fails.

Add double-quotes to the frontier pattern to allow them to match.
Lua Code:
  1. ChatFrame_AddMessageEventFilter('CHAT_MSG_TEXT_EMOTES', function(self, event, msg, ...)
  2.     return false, (msg:gsub('%f[^%z%s"]([^\1-\64\91-\96\123-191]+)%-%u%l%a+%f[%z%s"]', '%1')), ...
  3. end)
  Reply With Quote