question about speed of sequential string replacement vs regex or

Eli the Bearded * at
Wed Sep 28 15:08:21 EDT 2011

In comp.lang.perl.misc, Willem  <willem at> wrote:
> In Perl, it would be applicable.  You see, in Perl, you can call a function
> in the replacement of the regex substitution, which can then look up the
> html entity and return the wanted unicode literal.

A function? I'd use a hash.

> I think you can do that in some other languages as well.

Hash / array type substitutions indexed by $1 (or language equivilent)
are probably easy to implement in many languages.

for really fast, write code to generate a C lexer to do it

More information about the Python-list mailing list