Avi Kak wrote: > Does regular expression processing in Python allow for executable > code to be embedded inside a regular expression? > > For example, in Perl the following two statements > > $regex = qr/hello(?{print "saw hello\n"})mello(?{print "saw > mello\n"})/; > "jellohellomello" =~ /$regex/; > > will produce the output > > saw hello > saw mello > > Is it possible to do the same in Python with any modules that come > with the standard distribution, or with any other modules?
Just in case you were referring to security concerns: Sufficiently complex REs can take ages to compile and run and eat tons of memory, so there are always issues involved here. Stefan -- http://mail.python.org/mailman/listinfo/python-list