Regular expression to match whole words.
jepler epler
jepler.lnk at lnk.ispi.net
Sun Oct 1 09:01:14 EDT 2000
>> rePattern = r"\b(" + rePattern + r")\b"
On Wed, 27 Sep 2000 15:45:55 +0100, Simon Brunning
<SBrunning at trisystems.co.uk> wrote:
>Just as a matter if interest, what to the parentheses do, since it seems to
>work fine without?
It's like the parentheses in
4 * (1+4)
versus
4*1 + 4
so that if rePattern was a|b, you match "beginning of a word, then either a
or b, and then the end of a word" rather than "the beginning of a word, then
a" or "b and then the end of a word"
They also have the side effect of being a match group.
Jeff
More information about the Python-list
mailing list