help make it faster please

Fredrik Lundh fredrik at pythonware.com
Thu Nov 10 15:00:40 EST 2005


Lonnie Princehouse wrote:

> "[a-z0-9_]" means "match a single character from the set {a through z,
> 0 through 9, underscore}".

"\w" should be a bit faster; it's equivalent to "[a-zA-Z0-9_]" (unless you
specify otherwise using the locale or unicode flags), but is handled more
efficiently by the RE engine.

(you can use \w in sets too, so you can do e.g. "[\w@]")

</F>






More information about the Python-list mailing list