Regular expression to match whole words.

Calvelo Daniel dcalvelo at
Wed Sep 27 18:41:24 CEST 2000

Simon Brunning <SBrunning at> wrote:
[Tim Peters explains r'\b' for regexps and comes with]
:     rePattern = r"\b(" + rePattern + r")\b"
[But then Simon Brunning jumps]
: Just as a matter if interest, what to the parentheses do, 
: since it seems to work fine without?

If you wish to test for match, it's ok to do without ()'s. I guess
Tim meant to get things prepared in case you wanted to do stg with
your matches. .group() and ilk, I mean.


-- Daniel Calvelo Aros
     calvelo at

More information about the Python-list mailing list