use re.search() rather than re.match() in a couple places

(search() looks for the regex anywhere in the string whereas
match() only looks for the regex starting from the beginning)
This commit is contained in:
Brian S. Stephan 2010-10-29 00:30:02 -05:00
parent b5e71d677f
commit b7f2b9bd0e
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ class Module(object):
# setup regexp function in sqlite
def regexp(expr, item):
reg = re.compile(expr)
return reg.match(item) is not None
return reg.search(item) is not None
self.conn.create_function('REGEXP', 2, regexp)
# set up database for this module

View File

@ -69,7 +69,7 @@ class Alias(Module):
for alias in alias_list:
alias_re = re.compile(alias)
if alias_re.match(what):
if alias_re.search(what):
command = re.sub(alias, self.config.get(self.__class__.__name__, alias), what)
reply = self.try_recursion(connection, event, nick, userhost, None, command, admin_unlocked)
if not reply == command: