Thread Tools Display Modes
04-24-06, 07:07 PM   #1
Maia
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 15
help with regular expressions

I'm trying to parse the playerNames from the combat log. Therefor I'm watching some events. DamageMeters is using string.find such as:

string.gfind(arg1, "(.+) hits (.+) for (%d+)")
string.gfind(arg1, "(.+) crits (.+) for (%d+)")
string.gfind(arg1, "(.+) hits (.+) for (%d+)%. %((%d+) resisted%)")
string.gfind(arg1, "(.+) crits (.+) for (%d+)%.")

Well, as I only need the playerName I guess I can combine these into one regexp:

string.gfind(arg1, "(%a+) hits (%a+) .+")

This works. What doesn't work is:

string.gfind(arg1, "(%a+) hits|crits (%a+) .+")
nor does
string.gfind(arg1, "(%a+) (hits|crits) (%a+) .+")

what am I doing wrong?
  Reply With Quote
04-24-06, 08:24 PM   #2
barebone
A Murloc Raider
Join Date: Apr 2006
Posts: 8
Lua does not use POSIX regular expressions (regexp) for pattern matching. Go www.lua.org for further explanation - seems it involved too much code, so basically they reinvented regular expressions in a "light" way.

Not even sure you can do OR (|) in lua, havent found any documentation.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » help with regular expressions

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off