On 14 Jun 2005 04:01:58 -0700, rumours say that "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> might have written:
>I want to match a word against a string such that 'peter' is found in
>"peter bengtsson" or " hey peter," or but in "thepeter bengtsson" or
>"hey peterbe," because the word has to stand on its own. The following
>code works for a single word:
[snip]
use \b before and after the word you search, for example:
rePeter= re.compile("\bpeter\b", re.I)
In the documentation for the re module, Subsection 4.2.1 is Regular
Expression Syntax; it'll help a lot if you read it.
Cheers.
--
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...
--
http://mail.python.org/mailman/listinfo/python-list