help make it faster please

Fredrik Lundh fredrik at
Thu Nov 10 21:00:40 CET 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@]")


More information about the Python-list mailing list