regexp match string with word1 and not word2

Steven Bethard steven.bethard at gmail.com
Mon Apr 30 11:11:34 EDT 2007


Flyzone wrote:
> Hello,
> i have again problem with regexp :-P
> I need to match all lines that contain one word but not contain
> another.
> Like to do "grep one | grep -v two:"

You don't need a regexp:;

     if 'one' in line and 'two:' not in line:
         ... do something...

STeVe



More information about the Python-list mailing list