Quantcast pattern matching - WoWInterface
Thread Tools Display Modes
06-24-16, 07:05 PM   #1
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
pattern matching

Code:
local eMail = GetAddOnMetadata(AddOn, "X-Email"):lower()
In the above line of code, how would I get it to find/match/not freak out if the user has any number of unknown to me variant spellings of "email"?

What I really need is the "email" part, and have zero use for "X-" (I know how to gsub that out after the ToC lookup), but just off the top of my head:
  • X-Email
  • X-eMail
  • email
  • eMail
  • EMail
  • etc
These are obviously not the same, and if variant exists in MyAddOn, a different variant could exist in YourAddOn.

Last edited by myrroddin : 06-24-16 at 07:07 PM. Reason: forgot the code tags
  Reply With Quote
06-24-16, 07:33 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,918
As far as I know, Blizzard ignores non-standard tags that don't start with "X-". On whether or not tags are case-sensitive, I don't know and it would be something to test. If it is case-sensitive, you'd have to check each variant as there is no way to pass a pattern through the API to fetch the tag.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
06-24-16, 08:09 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,727
Is this for your LibAboutPanel rewrite? If an author wants to use LibAboutPanel, and they want their email to display on the panel in-game, then they should format/spell it the way you tell them to.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
06-24-16, 08:28 PM   #4
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,109
Yes it is about the rewrite. But also about testing the GetAddOnmetadata API. Turns out that SDPhantom was correct:
  • Capitalization does not matter, both x- and X- had the same result (same with Version and version)
  • Non-standard fields require X- in front of them
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » pattern matching

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