# module code
import re
from collections import namedtuple
-re_findsub = re.compile(r"s(.)(?P<search>[^\1]+)\1(?P<replace>[^\1]+)\1(?P<global>g)?;?")
+re_findsub = re.compile(r"s(.)(?P<search>.+?)\1(?P<replace>.+?)(?:\1(?P<global>g)?|$)")
Line = namedtuple('Line', ['sender', 'msg'])
lastline = {}
@lib.hooknum("PRIVMSG")
msg = pieces[3][1:]
mo = re_findsub.match(msg)
if mo:
+ bot.msg(chan, `mo.groups()`)
if mo.group('global') is not None:
count = 0 # unlimited
else: