builtin regular expressions?

MonkeeSage MonkeeSage at gmail.com
Sun Oct 1 07:03:43 EDT 2006


Mirco Wahab wrote:
> Therefore, I'd like to have a usable and understandable
> example of Regex-object juggling, that shows clearly
> what its real benefit is (or gives an idea of - ).

Here are some benefits:

DRY - You can assign a regexp to a variable and pass it around or call
specific instance methods on it. Thus...
Overhead - You don't need to keep compiling the same expression if you
need to use it several times, you can just assign it to a variable and
reference that.
Clarity - named methods are clearer than operators. ( .match vs. =~ ).

Regards,
Jordan




More information about the Python-list mailing list