On Monday 05 October 2009, Carl Banks wrote: > Why do you have to use a regexp at all?
not one but many with arbitrary content. please read my answer to Stefan. Take a look at the regexes I am using: http://websvn.kde.org/trunk/playground/games/kmj/src/predefined.py?view=markup moreover they are saved in a data base. I would not want to do that with python code. Actually I already did that - I defined Python classes which made it possible to write a rule as (example) self.mjRules.append(Rule('Fourfold Plenty', 'PKong()*4 + Pair()', limits=1)) see http://websvn.kde.org/trunk/playground/games/kmj/src/rulesets.py?view=markup&pathrev=998607 this was then executed with eval. But eval seems unsafe and some rules were simply not writable that way without specialized hard wired python code. That is not what I envision. Also regex turned out to have about the same speed IIRC -- Wolfgang -- http://mail.python.org/mailman/listinfo/python-list