So apparently I'm getting nil from this matching function. It really doesn't make much sense, but I might be overestimating :match() -- can it not have more than one character between captures?
As you can see, I make a pattern using the setName and wholeName and some hyphens, and try matching it. Nothing is returned though, despite the 'should-be-valid' captures
setName = "BKP" wholeName = "BREAKpoint" wholeName = wholeName:lower(); pattern = "(.+)-"..wholeName:lower().."-"..setName:lower().."-(.+)" print(pattern) example = "ferroseed-breakpoint-bkp-79" key, val = example:match(pattern) print( key ) print( val )
Output
(.+)-breakpoint-bkp-(.+) nil nil
-
is a quantifier. You'll want to escape it with %
.
pattern = "(.+)%-"..wholeName:lower().."%-"..setName:lower().."%-(.+)"