Strange regex problem

Rene Pijlman at the.newsgroup
Mon Mar 3 23:21:31 CET 2003

John Machin:
>Rene Pijlman:
>> If my understanding is correct, the documentation of search() on
>> compiled vs. uncompiled re's is somewhat confusing
>IMO the doco should juxtapose the contenders (for each of search and
>match), and explain that the two-step variety has more options:
>   re_obj = re.compile(pattern[, flags]) 
>   match_obj =[, pos[, endpos]]) 
>   match_obj =, string[, flags]) 
>It may also be worthwhile stating (for sub, subn, etc also) that the
>two-step option may be (or is, if true) faster for multiple searches
>etc than the one-step option.
>I also think that the module-level functions should be described in
>terms of the two-step variety, not the other way around ... "As a
>convenience for one-off and/or casual usage, result = re.xxxx(...) is
>provided as (mostly) equivalent to re_obj = re.compile(...); result =

Sounds good to me.

René Pijlman

More information about the Python-list mailing list