WoW Player Link Lua Pattern Matching

366 views Asked by At

Had a question. What would be the best way to match a chunk out of the following:

|Hplayer:Aerdrig:1:WHISPER:AERDRIG|h[Aerdrig]|h

I need the bold from the above line but not all World of Warcraft links follow that pattern. But these and Battle.net links. They use |K.

Heres some readup on it:

|K[gsf][0-9]+|k[0]+|k

New in 4.0 - Represents a Battle.net friend's name. The 3rd character indicates given name, surname, or full name. The number which follows it represents the friend's Bnet Presence ID. The zeros between the |k form a string of the same length as the name which will replace it. E.g. if your first name is John and your presence id is 30, your given name (John) would be represented by the string |Kg30|k0000|k.

While it would be nice to have that data I can do without battle.net messages. I need a better capture pattern for player links than using:

h%[.-%]%|

After pulling the word out of the sentence.

I appreciate all the help you all can give me. I am too new to patterns to get this myself.

0

There are 0 answers