[Tutor] Help required

Lie Ryan lie.1296 at gmail.com
Sat Sep 26 11:01:49 EDT 2009


waqas ahmad wrote:
> Now i want to search all those pages, where i have *NOT* written "#acl 
> InternationalGroup:read" *But*  i have written only "CatInternational" 
> in the page text.

You can split the two queries into two regexes:

import re
acl = re.compile(r'#acl InternationalGroup:read')
cat = re.compile(r'CatInternational')
s = ' ... '

if not acl.search(s) and cat.search(s):
     print 's contains cat but not acl'




More information about the Python-list mailing list