Pattern matching is my Kryptonite!
I am writing an external AddOn that converts invalid itemID lists into valid ones for TradeSkillMaster. However, for all that I have been reading on wowpedia.org and the official Lua documentation, I am stuck on matching exactly what I want in strings.
These are valid for TSM:
Code:
local maybe_valid = string.gmatch(myString, "%d+$" Checking if it is valid is easy, I think. Code:
local valid = string.gmatch(myString, "i:%d+$" |
Would the following work, or does this need to be more complex?
Code:
local valid = string.gmatch(myString, "i:%d+$") |
It's not my forte so this is probably not very efficient if it does work.
Code:
local valid = string.gsub(myString, "[i:]+[0-9]+", replaceString) |
As for finding valid and invalid (turns out I need both, but need to know the difference) this might work:
Code:
local valid = true |
How about making everything wrong and fixing it all:
Code:
s = "I:1234,3450,i:9867" |
Quote:
|
All times are GMT -6. The time now is 03:29 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI