On Sun, 16 Sep 2007, Mojca Miklavec wrote: > On 9/14/07, Hans Hagen <[EMAIL PROTECTED]> wrote:
>> mojcasentities = { >> nbsp = " ", >> le = "'\\mathematics{\\le}' >> } >> >> local d[k]= d[k]:gsub("&(.-);",mojcasentities) > > Yes, I saw it, but didn't try to understand what the &(.-) serves for. (Caveat: I do not really know lua regex, and have not tried out the code) Assuming lua follows standard regex syntax, this means & # The letter & ( # start a group . # any character - # As few as needed ) # end group ; # the letter ; so this will match all entities. If it helps, the equivalent vim regex will be \&\(.\{-}\); I guess that $1 (the first group, that is everything that matches .-) will be compared with mojcaentities table and replaced accordingly. This looks like a really nice feature of lua. In Ruby and Vim, I often find myself writing a bunch of similar regex, and always wished there was something like what lua does. Aditya ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________