Helpviewer/GreaseMonkey/GreaseMonkeyUrlMatcher.py

changeset 2954
bf0215fe12d1
parent 2302
f29e9405c851
child 3002
6ffc581f00f1
equal deleted inserted replaced
2953:703452a2876f 2954:bf0215fe12d1
16 """ 16 """
17 Module function implementing a special wildcard matcher. 17 Module function implementing a special wildcard matcher.
18 18
19 @param string string to match (string) 19 @param string string to match (string)
20 @param pattern pattern to be used (string) 20 @param pattern pattern to be used (string)
21 @return flag indicating a successful match (boolean)
21 """ 22 """
22 stringSize = len(string) 23 stringSize = len(string)
23 24
24 startsWithWildcard = pattern.startswith("*") 25 startsWithWildcard = pattern.startswith("*")
25 endsWithWildcard = pattern.endswith("*") 26 endsWithWildcard = pattern.endswith("*")
71 def match(self, urlString): 72 def match(self, urlString):
72 """ 73 """
73 Public method to match the given URL. 74 Public method to match the given URL.
74 75
75 @param urlString URL to match (string) 76 @param urlString URL to match (string)
77 @return flag indicating a successful match (boolean)
76 """ 78 """
77 if self.__useRegExp: 79 if self.__useRegExp:
78 return self.__regExp.indexIn(urlString) != -1 80 return self.__regExp.indexIn(urlString) != -1
79 else: 81 else:
80 return wildcardMatch(urlString, self.__matchString) 82 return wildcardMatch(urlString, self.__matchString)

eric ide

mercurial