Regular expression to match whole words.

Calvelo Daniel dcalvelo at pharion.univ-lille2.fr
Wed Sep 27 18:41:24 CEST 2000


Simon Brunning <SBrunning at trisystems.co.uk> 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.

HTH, DCA

-- Daniel Calvelo Aros
     calvelo at lifl.fr



More information about the Python-list mailing list