Logo Search packages:      
Sourcecode: wapiti version File versions  Download package

def lswww::lswww::reWildcard (   self,
  regexp,
  string 
)

Wildcard-based regular expression system

Definition at line 338 of file lswww.py.

00338                                         :
            """Wildcard-based regular expression system"""
            regexp=re.sub("\*+","*",regexp)
            match=True
            if regexp.count("*")==0:
                  if regexp==string:
                        return True
                  else:
                        return False
            blocks=regexp.split("*")
            start=""
            end=""
            if not regexp.startswith("*"):
                  start=blocks[0]
            if not regexp.endswith("*"):
                  end=blocks[-1]
            if start!="":
                  if string.startswith(start):
                        blocks=blocks[1:]
                  else:
                        return False
            if end!="":
                  if string.endswith(end):
                        blocks=blocks[:-1]
                  else:
                        return False
            blocks=[block for block in blocks if block!=""]
            if blocks==[]:
                  return match
            for block in blocks:
                  i=string.find(block)
                  if i==-1: return False
                  string=string[i+len(block):]
            return match

      def go(self):


Generated by  Doxygen 1.6.0   Back to index