Thread Tools Display Modes
08-14-09, 10:14 AM   #1
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Regex alternatives?

Edit: I understand now that the topic title is a bit misleading. I meant "Alterations"


Does WoW not support alterations ?
e.g. "start (part1|part2|part3) end"


Edit: When I'm already asking, what would be the option to match nothing or a string
e.g. "start end" or "start middle end"
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 08-14-09 at 10:22 AM.
  Reply With Quote
08-14-09, 10:33 AM   #2
xConStruct
A Chromatic Dragonspawn
 
xConStruct's Avatar
AddOn Author - Click to view addons
Join Date: May 2008
Posts: 199
Tested it in my interactive lua-console and you're right - it seems like Lua doesn't understand alternations, it ignores the vertical bar | and sees it as part of the normal characters.

"^start (.*) end$" would be a very universal regex which would fetch all things in between, this would output:
"start end" -> nil
"start middle end" -> "middle"

But maye you should specialize it a bit more to fit your case.
__________________
« Website | GitHub »

Oh hai!
  Reply With Quote
08-14-09, 11:38 AM   #3
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
http://lua-users.org/wiki/PatternsTutorial and http://www.wowwiki.com/HOWTO:_Use_Pattern_Matching

Are both good resources.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Regex alternatives?


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