def search (self,pattern,caseSens=True,debug=0):
"Intenta hacer Matching entre el pattern pasado por parametro y la ultima linea leida"
if not caseSens:
self.regexp=re.compile(pattern,re.IGNORECASE)
else:
self.regexp=re.compile(pattern)
self.matches=self.regexp.findall(self.lastline)
j=0
for i in self.matches:
if not type(i)==type(()):
self.matches[j]=tuple([self.matches[j]])
j+=1
# DEBUG PARA MATCHING
if (debug==1):
print "[",self.lastline,"-",pattern,"]"
print len(self.matches)
print self.matches
if len(self.matches)==0:
return False
else:
return True
评论列表
文章目录