luatex bug wrt matching/substitution ???
Maybe I am missing something, but why do I get from this program:
local first = "catalogue-ctan"
local cdata = string.gsub(first,'^catalogue-', '')
print ("first = "..first)
print ("cdata = "..cdata)
the output:
first = catalogue-ctan
cdata = e-ctan
Same happens with
local cdata = string.match(first,'^catalogue-(.*)')
(texlua from TeX Live repository)
Best wishes
Norbert
-------------------------------------------------------------------------------
Dr. Norbert Preining
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
On Di, 22 Jul 2008, Jonathan Sauer wrote:
You should use "^catalogue%-" to escape the "-", since it is a special character when inside the pattern (see the Lua reference manual, "Patterns").
Argg, thanks, yes. Coming from Perl world ....
Best wishes
Norbert
-------------------------------------------------------------------------------
Dr. Norbert Preining
participants (2)
-
Jonathan Sauer
-
Norbert Preining