22 Jul
2008
22 Jul
'08
8:10 a.m.
Hello,
local first = "catalogue-ctan" local cdata = string.gsub(first,'^catalogue-', '') print ("first = "..first) print ("cdata = "..cdata)
the output: first = catalogue-ctan
The pattern matches "catalogu" at the beginning of the string and then as few "e" as possible (minimum matching), therefore it matches "catalogu" and removes it. You should use "^catalogue%-" to escape the "-", since it is a special character when inside the pattern (see the Lua reference manual, "Patterns").
cdata = e-ctan
Same happens with local cdata = string.match(first,'^catalogue-(.*)')
Same thing.
(texlua from TeX Live repository)
Best wishes
HTH, Jonathan