On Tue, Apr 05, 2011 at 06:21:03PM +0530, Neha Jain wrote: > > > but the problem with this is that the line where I am searching for may be > like.. #define ABC_PG... so may be something for the start of the word type > matching may help.. \b?? i am not sure..
The reason that second pattern is inclusive of the first one, makes it bit tricky. You can also consider to do it two steps with splitting the words and verify that simpler strings do not startswith 'ABC_' pattern. >>> for each in re.split('\W','#define ABC_CDF\nAB_CDF'): ['', 'define', 'ABC_CDF', 'AB_CDF'] -- Senthil _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers