Originally Posted by Choonstertwo
You could use a slightly less restrictive pattern that matches everything after the first dash:
lua Code:
("PLAYERNAME-Aggra(Português)"):gsub("%-.+", "")
You could also use the WoW-specific strsplit function:
lua Code:
(strsplit("-", "PLAYERNAME-Aggra(Português)", 2))
Note the extra set of parentheses to discard all return values except the first.
|
The reason i used the %a+ pattern because sometime i also have to handle string like this:
"PetName-ServerName <OwnerName-ServerName>"
I havn't tried the built in strsplit but i don't think it would make a difference, usually the default Blizzard functions handle utf8 stuff even worse.