How can I exclude a word by using re?

could ildg could.net at gmail.com
Sun Aug 14 10:24:08 EDT 2005


In re, the punctuation "^" can exclude a single character, but I want
to exclude a whole word now. for example I have a string "hi, how are
you. hello", I want to extract all the part before the world "hello",
I can't use ".*[^hello]" because "^" only exclude single char "h" or
"e" or "l" or "o". Will somebody tell me how to do it? Thanks.



More information about the Python-list mailing list