Aditya Mahajan wrote:

> (Caveat: I do not really know lua regex, and have not tried out the 
> code)

they are not regexp but expressions -)

> 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.

just &(.-); with () being the capture


> If it helps, the equivalent vim regex will be
> \&\(.\{-}\);
> 
> I guess that $1 (the first group, that is everything that matches .-) 

%1

> will be compared with mojcaentities table and replaced accordingly. 

indeed

> 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.

the nice thing about many lua feature is that less code (lua c code) 
behaves more powerful




-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to