Hallöchen! Charles Sanders writes:
> Torsten Bronger wrote: > > [...] > >>>> Example string: u"Hollo", escaped positions: [4]. Thus, the >>>> second "o" is escaped and must not be found be the regexp >>>> searches. >>>> >>>> Instead of re.search, I call the function guarded_search(pattern, >>>> text, offset) which takes care of escaped caracters. Thus, while > > I'm still pretty much a beginner, and I am not sure > of the exact requirements, but the following seems to work > for at least simple cases when overlapping matches are not > considered. > > def guarded_search( pattern, text, exclude ): > return [ m for m in re.finditer(pattern,text) > if not [ e for e in exclude if m.start() <= e < m.end() ] ] Yes, this seems to do the trick, thank you! Tschö, Torsten. -- Torsten Bronger, aquisgrana, europa vetus Jabber ID: [EMAIL PROTECTED] (See http://ime.webhop.org for ICQ, MSN, etc.) -- http://mail.python.org/mailman/listinfo/python-list